-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Prototype with proposed i18n architecture #1478
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
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
44f95cb
Branch with i18n functionality
oruburos fe770f0
Branch with i18n functionality
oruburos 0d584f5
Translation files with new entries
oruburos a5e4102
Cleaner code in i18n
oruburos bbed8f8
Deleted comments i18n
oruburos d458159
includes Loader in index.jsx
oruburos 23a41ab
includes Loader in index.jsx
oruburos aac95a5
New Namespace
oruburos a369b0e
Shortcuts Modal Complete
oruburos b2a2223
Preferences complete
oruburos 1b287ae
About overlay title translated
oruburos 209ade6
Merge remote-tracking branch 'remotes/upstream/develop' into translat…
oruburos a942b04
withTranslation props deleted
oruburos 35f60cd
Merge branch 'translations' into i18n
oruburos 19e3946
Debug Set to False
oruburos 7c1708c
Adding the t function to test
oruburos d99a75b
Snapshot updated
oruburos 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,37 @@ | ||
import i18n from 'i18next'; | ||
import { initReactI18next } from 'react-i18next'; | ||
// import detector from 'i18next-browser-languagedetector';// | ||
// import Fetch from 'i18next-fetch-backend'; | ||
// import Fetch from 'i18next-fetch-backend'; | ||
import Backend from 'i18next-http-backend'; | ||
|
||
const fallbackLng = ['en']; | ||
const availableLanguages = ['en', 'es']; | ||
andrewn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const options = { | ||
loadPath: '/locales/{{lng}}/translations.json', | ||
requestOptions: { // used for fetch, can also be a function (payload) => ({ method: 'GET' }) | ||
mode: 'no-cors' | ||
}, | ||
allowMultiLoading: false, // set loadPath: '/locales/resources.json?lng={{lng}}&ns={{ns}}' to adapt to multiLoading | ||
}; | ||
|
||
i18n | ||
.use(initReactI18next) // pass the i18n instance to react-i18next. | ||
.use(Backend).init({ | ||
lng: 'en', | ||
defaultNS: 'menu', | ||
fallbackLng, // if user computer language is not on the list of available languages, than we will be using the fallback language specified earlier | ||
debug: true, | ||
andrewn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
backend: options, | ||
getAsync: false, | ||
initImmediate: false, | ||
useSuspense: true, | ||
whitelist: availableLanguages, | ||
interpolation: { | ||
escapeValue: false | ||
andrewn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
saveMissing: true, | ||
andrewn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
|
||
export default i18n; |
This file contains hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,98 @@ | ||
{ | ||
"About": { | ||
"Contribute": "Contribute", | ||
"NewPj5": "New to p5.js?", | ||
"Report": "Report a bug", | ||
"Learn": "Learn", | ||
"About": "About", | ||
"Resources": "Resources", | ||
"Libraries": "Libraries", | ||
"Forum": "Forum" | ||
}, | ||
"Menu": { | ||
"File": "File", | ||
"New": "New", | ||
"Save": "Save", | ||
"Examples": "Examples", | ||
"Edit": "Edit", | ||
"TidyCode": "Tidy Code", | ||
"Find": "Find", | ||
"AddToCollection": "Add to Collection", | ||
"FindNext": "Find Next", | ||
"FindPrevious": "Find Previous", | ||
"Sketch": "Sketch", | ||
"AddFile": "Add File", | ||
"AddFolder": "Add Folder", | ||
"Run": "Run", | ||
"Stop": "Stop", | ||
"Help": "Help", | ||
"KeyboardShortcuts": "Keyboard Shortcuts", | ||
"Reference": "Reference", | ||
"About": "About", | ||
"Tidy": "Tidy", | ||
"Lang": "Language"}, | ||
"Settings": { | ||
"FindNextMatch": "Find Next Match", | ||
"FindPrevMatch": "Find Previous Match", | ||
"IndentCodeLeft": "Indent Code Left", | ||
"IndentCodeRight": "Indent Code Right", | ||
"CommentLine": "Comment Line", | ||
"StartSketch": "Start Sketch", | ||
"StopSketch": "StopSketch", | ||
"TurnOnAccessibleOutput": "Turn On Accessible Output", | ||
"TurnOffAccessibleOutput": "Turn Off Accessible Output", | ||
"ToogleSidebar": "Toogle Sidebar", | ||
"ToogleConsole": "Toogle Console", | ||
"Preview": "Preview", | ||
"Auto-refresh": "Auto-refresh", | ||
"Console": "Console", | ||
"Settings": "Settings", | ||
"GeneralSettings": "General settings", | ||
"Theme": "Theme", | ||
"Light": "Light", | ||
"Dark": "Dark", | ||
"HighContrast": "High Contrast", | ||
"TextSize": "Text Size", | ||
"Decrease": "Decrease", | ||
"Increase": "Increase", | ||
"IndentationAmount": "Indentation amount", | ||
"Autosave": "Autosave", | ||
"On": "On", | ||
"Off": "Off", | ||
"SketchSettings": "Sketch Settings", | ||
"SecurityProtocol": "Security Protocol", | ||
"ServeOverHTTPS": "Serve over HTTPS", | ||
"Accesibility": "Accesibility", | ||
"LintWarningSound": "Lint Warning Sound", | ||
"PreviewSound": "Preview sound", | ||
"AccessibleTextBasedCanvas": "Accessible text-based canvas", | ||
"UsedScreenReader": "Used with screen reader", | ||
"Plain-text": "Plain-text", | ||
"Table-text": "Table-text", | ||
"Sound": "Sound", | ||
"WordWrap": "Word Wrap", | ||
"LineNumbers": "Line Numbers", | ||
"LangChange": "Language changed" | ||
}, | ||
"Login": { | ||
"Welcome": "Welcome", | ||
"Login": "Login", | ||
"LoginOr": "or", | ||
"SignUp": "Sign Up", | ||
"Email": "email", | ||
"Username": "username", | ||
"LoginGithub": "Login with Github", | ||
"LoginGoogle": "Login with Google", | ||
"DontHaveAccount": "Don't have an account?", | ||
"ForgotPassword": "Forgot your password?", | ||
"ResetPassword": "Reset your password", | ||
"BackEditor": "Back to Editor", | ||
"UsernameSplit": "User Name", | ||
"Password": "Password", | ||
"ConfirmPassword": "Confirm Password" | ||
}, | ||
"Toast": { | ||
"LangChange": "Language changed!!!", | ||
"OpenedNewSketch": "Opened new sketch." | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.