Skip to content

Commit 4ace125

Browse files
authored
Move localisation to Crowdin (#6518)
* 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
1 parent c9156bd commit 4ace125

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+16697
-16207
lines changed

CONTRIBUTING.md

+4-37
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
[discord-img]: https://img.shields.io/discord/629952586895851530?label=discord%20chat
3737
[discord-url]: https://discord.gg/rTKhrqz
3838

39+
## Translations
40+
41+
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.
42+
3943
## Installation for development
4044

4145
Nightscout is a Node.js application. The basic installation of the software for local purposes is:
@@ -188,8 +192,6 @@ Also if you can't code, it's possible to contribute by improving the documentati
188192
| Core developers: | [@jasoncalabrese] [@MilosKozak] [@PieterGit] [@sulkaharo] |
189193
| Former Core developers: (not active): | [@bewest] |
190194
| Contributing developers: | [@jpcunningh] [@scottleibrand] [@komarserjio] [@jweismann] |
191-
| Release coordination 0.10.x: | [@PieterGit] [@sulkaharo] |
192-
| Release coordination 0.11.x: | [@PieterGit] |
193195
| Issue/Pull request coordination: | Please volunteer |
194196
| Cleaning up git fork spam: | Please volunteer |
195197
| Documentation writers: | [@andrew-warrington] [@unsoluble] [@tynbendad] [@danamlewis] [@rarneson] |
@@ -230,41 +232,6 @@ Also if you can't code, it's possible to contribute by improving the documentati
230232
| [`upbat` (Uploader Battery)](README.md#upbat-uploader-battery)| [@jpcunningh] | Please volunteer |
231233
| [`xdrip-js` (xDrip-js)](README.md#xdrip-js-xdrip-js)| [@jpcunningh] | Please volunteer |
232234

233-
### Translators
234-
235-
See `/translations` of your Nightscout, to view the current translation coverage and the missing items.
236-
Languages with less than 90% coverage will be removed in a future Nightscout versions.
237-
238-
| Language | List of translators | Status
239-
| ------------- | -------------------- |-------------------- |
240-
| Български (`bg`) |Please volunteer| OK |
241-
| Čeština (`cs`) |Please volunteer|OK |
242-
| Deutsch (`de`) |[@viderehh] [@herzogmedia] |OK |
243-
| Dansk (`dk`) | [@janrpn] |OK |
244-
| Ελληνικά (`el`)|Please volunteer|Needs attention: 68.5%|
245-
| English (`en`)|Please volunteer|OK|
246-
| Español (`es`) |Please volunteer|OK|
247-
| Suomi (`fi`)|[@sulkaharo] |OK|
248-
| Français (`fr`)|Please volunteer|OK|
249-
| עברית (`he`)| [@jakebloom] |OK|
250-
| Hrvatski (`hr`)|[@OpossumGit]|OK|
251-
| Italiano (`it`)|Please volunteer|OK|
252-
| 日本語 (`ja`)|[@LuminaryXion]|Working on this|
253-
| 한국어 (`ko`)|Please volunteer|Needs attention: 80.6%|
254-
| Norsk (Bokmål) (`nb`)|Please volunteer|OK|
255-
| Nederlands (`nl`)|[@PieterGit]|OK|
256-
| Polski (`pl`)|[@Bartlomiejsz]|OK|
257-
| Português (Brasil) (`pt`)|Please volunteer|OK|
258-
| Română (`ro`)|Please volunteer|OK|
259-
| Русский (`ru`)|[@apanasef]|OK|
260-
| Slovenčina (`sk`)|Please volunteer|OK|
261-
| Svenska (`sv`)|Please volunteer|OK|
262-
| Türkçe (`tr`)|[@diabetlum]|OK|
263-
| 中文(简体) (`zh_cn`) | [@jizhongwen]|OK|
264-
| 中文(繁體) (`zh_tw`) | [@jizhongwen]|Needs attention: 25.0%
265-
| 日本語 (`ja_jp`) | [@LuminaryXion]|
266-
267-
268235
### List of all contributors
269236
| Contribution area | List of contributors |
270237
| ------------------------------------- | -------------------- |

app.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ function create (env, ctx) {
154154
// serve the static content
155155
app.use(staticFiles);
156156

157+
app.use('/translations', express.static('translations', {
158+
maxAge
159+
}));
160+
157161
if (ctx.bootErrors && ctx.bootErrors.length > 0) {
158162
const bootErrorView = require('./lib/server/booterror')(env, ctx);
159163
bootErrorView.setLocals(app.locals);
@@ -220,11 +224,6 @@ function create (env, ctx) {
220224
, title: 'Nightscout reporting'
221225
, type: 'report'
222226
}
223-
, "/translations": {
224-
file: "translationsindex.html"
225-
, title: 'Nightscout translations'
226-
, type: 'translations'
227-
}
228227
, "/split": {
229228
file: "frame.html"
230229
, title: '8-user view'

crowdin.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
files:
2+
- source: /translations/en/*.json
3+
translation: /translations/%locale_with_underscore%.json

lib/client/index.js

+31-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ var receiveDData = require('./receiveddata');
1717

1818
var brushing = false;
1919

20+
var browserSettings;
21+
2022
var client = {};
2123

2224
$('#loadingMessageText').html('Connecting to server');
@@ -69,9 +71,7 @@ client.init = function init (callback) {
6971
return;
7072
}
7173
client.settingsFailed = false;
72-
console.log('Application appears to be online');
73-
$('#centerMessagePanel').hide();
74-
client.load(serverSettings, callback);
74+
client.loadLanguage(serverSettings, callback);
7575
}).fail(function fail (jqXHR) {
7676

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

113113
};
114114

115+
client.loadLanguage = function loadLanguage (serverSettings, callback) {
116+
117+
$('#loadingMessageText').html('Loading language file');
118+
119+
browserSettings = require('./browser-settings');
120+
client.settings = browserSettings(client, serverSettings, $);
121+
console.log('language is', client.settings.language);
122+
123+
let filename = language.getFilename(client.settings.language);
124+
125+
$.ajax({
126+
method: 'GET'
127+
, url: '/translations/' + filename
128+
}).done(function success (localization) {
129+
language.offerTranslations(localization);
130+
console.log('Application appears to be online');
131+
$('#centerMessagePanel').hide();
132+
client.load(serverSettings, callback);
133+
}).fail(function fail () {
134+
console.error('Loading localization failed, continuing with English');
135+
console.log('Application appears to be online');
136+
$('#centerMessagePanel').hide();
137+
client.load(serverSettings, callback);
138+
});
139+
140+
}
141+
115142
client.load = function load (serverSettings, callback) {
116143

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

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

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

1038-
1039-
client.authorizeSocket = function authorizeSocket() {
1064+
client.authorizeSocket = function authorizeSocket () {
10401065

10411066
console.log('Authorizing socket');
10421067
var auth_data = {

0 commit comments

Comments
 (0)