Skip to content

Commit

Permalink
Move localisation to Crowdin (#6518)
Browse files Browse the repository at this point in the history
* Update Crowdin configuration file

* Update Crowdin configuration file

* Add languages for pushing

* Update Crowdin configuration file

* Update source file en.json

* New translations en.json (Finnish)

* New translations en.json (Finnish)

* New translations en.json (Romanian)

* New translations en.json (Dutch)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Korean)

* New translations en.json (French)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (Spanish)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* Remove folders

* New translations en.json (Romanian)

* New translations en.json (Korean)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Japanese)

* New translations en.json (French)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Romanian)

* New translations en.json (Korean)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Japanese)

* New translations en.json (French)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (Norwegian Bokmal)

* Update Crowdin configuration file

* New translations en.json (Spanish)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Italian)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (French)

* New translations en.json (Romanian)

* New translations en.json (Norwegian Bokmal)

* Loading all languages now works

* * Fix unit tests
* Have server load localizations

* Adding some more keys

* New Crowdin updates (#6531)

* New translations en.json (Finnish)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Finnish)

* New translations en.json (Japanese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Italian)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (Spanish)

* New translations en.json (French)

* New translations en.json (Romanian)

* New translations en.json (Croatian)

* Update source file en.json

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Norwegian Bokmal)

* Remove old translation status tool

* Update CONTRIBUTING
  • Loading branch information
sulkaharo committed Nov 17, 2020
1 parent c9156bd commit 4ace125
Show file tree
Hide file tree
Showing 46 changed files with 16,697 additions and 16,207 deletions.
41 changes: 4 additions & 37 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
[discord-img]: https://img.shields.io/discord/629952586895851530?label=discord%20chat
[discord-url]: https://discord.gg/rTKhrqz

## Translations

Please visit our [project in Crowdin](https://crowdin.com/project/nightscout) to translate Nigthscout. If you want to add a new language, please get in touch with the dev team in Gitter.

## Installation for development

Nightscout is a Node.js application. The basic installation of the software for local purposes is:
Expand Down Expand Up @@ -188,8 +192,6 @@ Also if you can't code, it's possible to contribute by improving the documentati
| Core developers: | [@jasoncalabrese] [@MilosKozak] [@PieterGit] [@sulkaharo] |
| Former Core developers: (not active): | [@bewest] |
| Contributing developers: | [@jpcunningh] [@scottleibrand] [@komarserjio] [@jweismann] |
| Release coordination 0.10.x: | [@PieterGit] [@sulkaharo] |
| Release coordination 0.11.x: | [@PieterGit] |
| Issue/Pull request coordination: | Please volunteer |
| Cleaning up git fork spam: | Please volunteer |
| Documentation writers: | [@andrew-warrington] [@unsoluble] [@tynbendad] [@danamlewis] [@rarneson] |
Expand Down Expand Up @@ -230,41 +232,6 @@ Also if you can't code, it's possible to contribute by improving the documentati
| [`upbat` (Uploader Battery)](README.md#upbat-uploader-battery)| [@jpcunningh] | Please volunteer |
| [`xdrip-js` (xDrip-js)](README.md#xdrip-js-xdrip-js)| [@jpcunningh] | Please volunteer |
### Translators
See `/translations` of your Nightscout, to view the current translation coverage and the missing items.
Languages with less than 90% coverage will be removed in a future Nightscout versions.
| Language | List of translators | Status
| ------------- | -------------------- |-------------------- |
| Български (`bg`) |Please volunteer| OK |
| Čeština (`cs`) |Please volunteer|OK |
| Deutsch (`de`) |[@viderehh] [@herzogmedia] |OK |
| Dansk (`dk`) | [@janrpn] |OK |
| Ελληνικά (`el`)|Please volunteer|Needs attention: 68.5%|
| English (`en`)|Please volunteer|OK|
| Español (`es`) |Please volunteer|OK|
| Suomi (`fi`)|[@sulkaharo] |OK|
| Français (`fr`)|Please volunteer|OK|
| עברית (`he`)| [@jakebloom] |OK|
| Hrvatski (`hr`)|[@OpossumGit]|OK|
| Italiano (`it`)|Please volunteer|OK|
| 日本語 (`ja`)|[@LuminaryXion]|Working on this|
| 한국어 (`ko`)|Please volunteer|Needs attention: 80.6%|
| Norsk (Bokmål) (`nb`)|Please volunteer|OK|
| Nederlands (`nl`)|[@PieterGit]|OK|
| Polski (`pl`)|[@Bartlomiejsz]|OK|
| Português (Brasil) (`pt`)|Please volunteer|OK|
| Română (`ro`)|Please volunteer|OK|
| Русский (`ru`)|[@apanasef]|OK|
| Slovenčina (`sk`)|Please volunteer|OK|
| Svenska (`sv`)|Please volunteer|OK|
| Türkçe (`tr`)|[@diabetlum]|OK|
| 中文(简体) (`zh_cn`) | [@jizhongwen]|OK|
| 中文(繁體) (`zh_tw`) | [@jizhongwen]|Needs attention: 25.0%
| 日本語 (`ja_jp`) | [@LuminaryXion]|
### List of all contributors
| Contribution area | List of contributors |
| ------------------------------------- | -------------------- |
Expand Down
9 changes: 4 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ function create (env, ctx) {
// serve the static content
app.use(staticFiles);

app.use('/translations', express.static('translations', {
maxAge
}));

if (ctx.bootErrors && ctx.bootErrors.length > 0) {
const bootErrorView = require('./lib/server/booterror')(env, ctx);
bootErrorView.setLocals(app.locals);
Expand Down Expand Up @@ -220,11 +224,6 @@ function create (env, ctx) {
, title: 'Nightscout reporting'
, type: 'report'
}
, "/translations": {
file: "translationsindex.html"
, title: 'Nightscout translations'
, type: 'translations'
}
, "/split": {
file: "frame.html"
, title: '8-user view'
Expand Down
3 changes: 3 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
files:
- source: /translations/en/*.json
translation: /translations/%locale_with_underscore%.json
37 changes: 31 additions & 6 deletions lib/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ var receiveDData = require('./receiveddata');

var brushing = false;

var browserSettings;

var client = {};

$('#loadingMessageText').html('Connecting to server');
Expand Down Expand Up @@ -69,9 +71,7 @@ client.init = function init (callback) {
return;
}
client.settingsFailed = false;
console.log('Application appears to be online');
$('#centerMessagePanel').hide();
client.load(serverSettings, callback);
client.loadLanguage(serverSettings, callback);
}).fail(function fail (jqXHR) {

// check if we couldn't reach the server at all, show offline message
Expand Down Expand Up @@ -112,6 +112,33 @@ client.init = function init (callback) {

};

client.loadLanguage = function loadLanguage (serverSettings, callback) {

$('#loadingMessageText').html('Loading language file');

browserSettings = require('./browser-settings');
client.settings = browserSettings(client, serverSettings, $);
console.log('language is', client.settings.language);

let filename = language.getFilename(client.settings.language);

$.ajax({
method: 'GET'
, url: '/translations/' + filename
}).done(function success (localization) {
language.offerTranslations(localization);
console.log('Application appears to be online');
$('#centerMessagePanel').hide();
client.load(serverSettings, callback);
}).fail(function fail () {
console.error('Loading localization failed, continuing with English');
console.log('Application appears to be online');
$('#centerMessagePanel').hide();
client.load(serverSettings, callback);
});

}

client.load = function load (serverSettings, callback) {

var FORMAT_TIME_12 = '%-I:%M %p'
Expand Down Expand Up @@ -162,7 +189,6 @@ client.load = function load (serverSettings, callback) {
.attr('class', 'tooltip')
.style('opacity', 0);

var browserSettings = require('./browser-settings');
client.settings = browserSettings(client, serverSettings, $);

language.set(client.settings.language).DOMtranslate($);
Expand Down Expand Up @@ -1035,8 +1061,7 @@ client.load = function load (serverSettings, callback) {
// Alarms and Text handling
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


client.authorizeSocket = function authorizeSocket() {
client.authorizeSocket = function authorizeSocket () {

console.log('Authorizing socket');
var auth_data = {
Expand Down
Loading

0 comments on commit 4ace125

Please sign in to comment.