Skip to content

Commit 2355125

Browse files
authored
Merge pull request #4233 from processing/i18next
add internationalization tooling
2 parents 1ce0206 + fbc8539 commit 2355125

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

contributor_docs/internationalization.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ The easiest way to do this is to add your language code (like "de" for German, "
8282

8383
This will generate you a fresh translations file in `translations/{LANGUAGE_CODE}/`! Now you can begin populating it with your fresh translations! 🥖
8484

85+
You'll also need to add an entry for it in `translations/index.js`. You can follow the pattern used in that file for `en` and `es`.
86+
8587
### Further Reading
8688
8789
See the [i18next translation function documentation](https://www.i18next.com/translation-function/essentials). Everything documented above is just a subset of their functionality.

src/core/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ const waitForDocumentReady = () =>
4444

4545
// only load translations if we're using the full, un-minified library
4646
const waitingForTranslator =
47-
typeof IS_MINIFIED === undefined ? initTranslator() : Promise.resolve();
47+
typeof IS_MINIFIED === 'undefined' ? initTranslator() : Promise.resolve();
4848

4949
Promise.all([waitForDocumentReady(), waitingForTranslator]).then(_globalInit);

src/core/internationalization.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export const initialize = () =>
3131
nestingPrefix: '$tr(',
3232
nestingSuffix: ')',
3333
defaultNS: 'translation',
34+
interpolation: {
35+
escapeValue: false
36+
},
37+
detection: {
38+
checkWhitelist: false
39+
},
3440
resources
3541
})
3642
.then(

translations/es/translation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"fes": {
3-
"autoplay": "",
3+
"autoplay": "Su browser impidío un medio tocar (de '{{src}}'), posiblemente porque las reglas de autoplay. Para aprender más, visite {{link}}.",
44
"fileLoadError": {
55
"bytes": "",
66
"font": "",

0 commit comments

Comments
 (0)