Skip to content

add internationalization tooling #4233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
fc55554
add i18next
outofambit Jan 5, 2020
35b1dce
add i18next scanner grunt task
outofambit Jan 5, 2020
c651a82
Update Gruntfile.js
outofambit Jan 5, 2020
d3466c3
Create internationalization.js
outofambit Jan 6, 2020
a921d10
testt drive
outofambit Jan 6, 2020
aa8a42f
Revert "Update Gruntfile.js"
outofambit Jan 6, 2020
2d26d15
Revert "add i18next scanner grunt task"
outofambit Jan 6, 2020
2e45438
remove i18next-scanner
outofambit Jan 6, 2020
e985c1d
add babel-plugin-i18next-extract
outofambit Jan 6, 2020
4b4627b
add config for i18next-extract
outofambit Jan 6, 2020
501c64a
dummy translator
outofambit Jan 6, 2020
ebf9233
begin translation key extraction
outofambit Jan 6, 2020
98bb298
better i18n keys
outofambit Jan 6, 2020
2c93b35
less config needed
outofambit Jan 6, 2020
a804820
reorder
outofambit Jan 6, 2020
70ce0e2
Update translation.json
outofambit Jan 6, 2020
b355fc7
add nesting config
outofambit Jan 6, 2020
30173f1
Update translation.json
outofambit Jan 6, 2020
ce49e06
different syntax for file load errors
outofambit Jan 6, 2020
3b873ae
setup language detector
outofambit Jan 6, 2020
e505274
create translations index
outofambit Jan 6, 2020
d4b73cf
wire up translation loading
outofambit Jan 6, 2020
28160c3
Update translation.json
outofambit Jan 6, 2020
a5bb89b
Update internationalization.js
outofambit Jan 6, 2020
7facf08
simplify
outofambit Jan 6, 2020
f7a945c
remove acorn
outofambit Jan 6, 2020
ba5d09c
cleanup
outofambit Jan 6, 2020
e6ce5e9
arguments not args
outofambit Jan 6, 2020
e1e21c5
Update internationalization.js
outofambit Jan 6, 2020
1643935
rework i18next init
outofambit Feb 17, 2020
dd9d2c8
force loading translations before we init p5
outofambit Feb 17, 2020
210f428
fix translator import
outofambit Feb 19, 2020
a63cd45
expand i18n to fes log prefix
outofambit Feb 19, 2020
50ce2bd
add test
outofambit Feb 19, 2020
2dfa5ce
add autopolay error to i18n keys
outofambit Feb 24, 2020
68470e7
move server link into code, out of translations
outofambit Feb 24, 2020
6804957
more inline documentation
outofambit Feb 24, 2020
80c8dc9
Update internationalization.js
outofambit Feb 24, 2020
89df8cc
don't split up url string
outofambit Feb 24, 2020
51e8b8b
fix up autoplay message
outofambit Feb 24, 2020
4d47744
i18n more fes messages
outofambit Feb 24, 2020
03c3c28
add asterisk to pre
outofambit Feb 24, 2020
0ba6e0f
move file load error strings under fes key
outofambit Feb 24, 2020
92f59b1
exclude translations from mini build
outofambit Feb 24, 2020
68ea053
add initial stub translator fn
outofambit Feb 24, 2020
10741fa
flowers 🌸
outofambit Feb 25, 2020
9097ca3
add i18n contributor guide
outofambit Feb 25, 2020
c5a1e3b
another note
outofambit Feb 25, 2020
8d2cf3d
add autoplay message en español
outofambit Feb 25, 2020
286372f
tweak
outofambit Feb 25, 2020
7447e2d
fix typeof check
outofambit Feb 25, 2020
288e55e
disable interpolation and language list check
outofambit Feb 25, 2020
fbc8539
Merge branch 'master' into i18next
lmccart Feb 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions contributor_docs/internationalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ The easiest way to do this is to add your language code (like "de" for German, "

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

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`.

### Further Reading

See the [i18next translation function documentation](https://www.i18next.com/translation-function/essentials). Everything documented above is just a subset of their functionality.
2 changes: 1 addition & 1 deletion src/core/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ const waitForDocumentReady = () =>

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

Promise.all([waitForDocumentReady(), waitingForTranslator]).then(_globalInit);
6 changes: 6 additions & 0 deletions src/core/internationalization.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export const initialize = () =>
nestingPrefix: '$tr(',
nestingSuffix: ')',
defaultNS: 'translation',
interpolation: {
escapeValue: false
},
detection: {
checkWhitelist: false
},
resources
})
.then(
Expand Down
2 changes: 1 addition & 1 deletion translations/es/translation.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"fes": {
"autoplay": "",
"autoplay": "Su browser impidío un medio tocar (de '{{src}}'), posiblemente porque las reglas de autoplay. Para aprender más, visite {{link}}.",
"fileLoadError": {
"bytes": "",
"font": "",
Expand Down