-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feature(www): Translate text through js-lingui #21633
Merged
Merged
Changes from 7 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
170d72e
WIP lingui integration
tesseralis 08dd899
translate and extract more stuff
tesseralis fdecff7
remove extraneous
tesseralis bbae55d
add toggle text
tesseralis 3eb5989
egghead embed
tesseralis 2c686bd
fix tests
tesseralis 5e47b02
rename lingui functions
tesseralis 17474b1
ignore translation files in typo check
tesseralis 2d878dd
Merge branch 'master' into lingui
tesseralis a18e353
Merge branch 'master' into lingui
tesseralis b7c886b
build lingui in onPreInit
tesseralis 2c1927e
finish everything
tesseralis 701e375
remove babelrc
tesseralis 5a95af0
add husky
tesseralis 18b045d
add stuff
tesseralis f655152
redo navigation
tesseralis ab159be
try to do something
tesseralis e6e0b2a
remove husky and lint-saged for now
tesseralis b739698
fix stuff
tesseralis 707083a
Merge branch 'master' into lingui
tesseralis a4f2134
move preset info to packages.json
tesseralis 386754b
move preset to extractCoptions"
tesseralis 5af54f3
Merge branch 'master' into lingui
tesseralis 822055b
reorganize i18n stuff
tesseralis 6fc6582
Merge branch 'master' into lingui
tesseralis 8ead7e3
fix locale provider
tesseralis fe2d9e9
move build logic
tesseralis ce3d606
Merge branch 'master' into lingui
tesseralis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": ["macros"], | ||
"presets": [["babel-preset-gatsby"]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,7 @@ src/cache | |
|
||
# Env variables | ||
.env* | ||
|
||
# Lingui | ||
src/data/locales/**/messages.js | ||
src/data/locales/_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"sourceLocale": "en", | ||
"localeDir": "src/data/locales", | ||
"srcPathDirs": ["src/components", "src/pages", "src/templates", "src/views"], | ||
"format": "po", | ||
"sorting": "origin" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
[ | ||
{ "code": "es", "name": "Spanish" }, | ||
{ "code": "id", "name": "Indonesian" }, | ||
{ "code": "ja", "name": "Japanese" }, | ||
{ "code": "pl", "name": "Polish" }, | ||
{ "code": "pt-BR", "name": "Brazilian Portuguese" }, | ||
{ "code": "zh-Hans", "name": "Simplified Chinese" } | ||
] | ||
[{ "code": "ja", "name": "Japanese" }] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the right place to put this? Can we do
prebuild
or something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could install
husky
andlint-staged
to run apre-commit
hook:gatsby/package.json
Lines 68 to 86 in 3894840
Or does this only need to be run before a build and not necessarily a commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lingui extract
is the thing that generates the .po files -- those need to be in the codebase so that translators know what they need to translate, so it needs to be pre-commit.Should I install husky on www or is there some way to use the one configured on top level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
www is separate so to speak, so yeah, go ahead with installing it there 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added husky and lint-staged but ran into two issues:
I don’t think its good to run it on every commit, especially since most www changes will not be string related. I was thinking that on build we could watch the translation files and fail build if there are any changes?