diff options
author | Emil Lundberg <emil@emlun.se> | 2023-11-13 21:04:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 21:04:24 +0100 |
commit | a1ad020b6387f851764cb9a6e97253df85cce12c (patch) | |
tree | 1c66930ca0e9e8030fd3278f627971659ca0a53c /gui | |
parent | 8f1b0df74b6be8842a3f1c13aa800356b8685bf5 (diff) | |
download | syncthing-a1ad020b6387f851764cb9a6e97253df85cce12c.tar.gz syncthing-a1ad020b6387f851764cb9a6e97253df85cce12c.zip |
Support explicit translation ID and dotted namespaces in translation extraction (#9192)
Some translations, especially single words or other short
labels for buttons and the like, may not be transferable between
contexts even if they happen to be equal in English. In these cases,
setting an explicit translation ID is important for context separation.
Angular Translate also supports nested JSON in translation tables,
addressed using `.` as namespace separator; this enhancement makes use
of this when extracting translation with an explicit translation ID.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/default/assets/lang/lang-en.json | 5 | ||||
-rw-r--r-- | gui/default/index.html | 1 | ||||
-rw-r--r-- | gui/default/syncthing/app.js | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/gui/default/assets/lang/lang-en.json b/gui/default/assets/lang/lang-en.json index 4a43240d8..0e7acfc04 100644 --- a/gui/default/assets/lang/lang-en.json +++ b/gui/default/assets/lang/lang-en.json @@ -538,6 +538,11 @@ "modified": "modified", "permit": "permit", "seconds": "seconds", + "test": { + "translation": { + "dummy": "(This is just a test string for nested translation namespaces. This does not need to be translated.)" + } + }, "theme-name-black": "Black", "theme-name-dark": "Dark", "theme-name-default": "Default", diff --git a/gui/default/index.html b/gui/default/index.html index 4c55ffd7b..186ae5321 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -1091,5 +1091,6 @@ <script type="text/javascript" src="syncthing/app.js"></script> <!-- / gui application code --> + <div translate="test.translation.dummy" style="display: none;">(This is just a test string for nested translation namespaces. This does not need to be translated.)</div> </body> </html> diff --git a/gui/default/syncthing/app.js b/gui/default/syncthing/app.js index 6c85be499..80e9a20d7 100644 --- a/gui/default/syncthing/app.js +++ b/gui/default/syncthing/app.js @@ -26,6 +26,7 @@ syncthing.config(function ($httpProvider, $translateProvider, LocaleServiceProvi prefix: 'assets/lang/lang-', suffix: '.json' }); + $translateProvider.fallbackLanguage('en'); LocaleServiceProvider.setAvailableLocales(validLangs); LocaleServiceProvider.setDefaultLocale('en'); |