-
Notifications
You must be signed in to change notification settings - Fork 0
331 i18n #332
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
Closed
331 i18n #332
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3dd9aed
introduce i18n lib
IanMayo 2019abc
early steps
IanMayo ebf8d36
reafactor component
IanMayo ba1b353
first translation
IanMayo 6b7ce41
italian translation
IanMayo 047c0f5
add nl translations
IanMayo b331972
fixes
IanMayo 70021e3
introduce dutch
IanMayo f922f15
fixes
IanMayo e640ad7
Update src/components/WelcomePage/index.tsx
IanMayo 9097730
Update src/components/WelcomePage/index.tsx
IanMayo 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 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,25 @@ | ||
| // src/components/WelcomePage/LanguageSelector.tsx | ||
| import React from 'react' | ||
| import { useTranslation } from 'react-i18next' | ||
|
|
||
| const LanguageSelector: React.FC = () => { | ||
| const { i18n } = useTranslation() | ||
|
|
||
| const changeLanguage = (event: React.ChangeEvent<HTMLSelectElement>) => { | ||
| const newLang = event.target.value | ||
| i18n.changeLanguage(newLang).then(() => { | ||
| // Force a re-render of the entire app | ||
| window.location.reload() | ||
| }) | ||
| } | ||
|
|
||
| return ( | ||
| <select onChange={changeLanguage} value={i18n.language}> | ||
| <option value="en">English</option> | ||
| <option value="it">Italiano</option> | ||
| <option value="nl">Nederlands</option> | ||
| </select> | ||
| ) | ||
| } | ||
|
|
||
| export default LanguageSelector | ||
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,22 @@ | ||
| import i18n from 'i18next' | ||
| import { initReactI18next } from 'react-i18next' | ||
| import enTranslations from './locales/en.json' | ||
| import itTranslations from './locales/it.json' | ||
| import nlTranslations from './locales/nl.json' | ||
|
|
||
| i18n | ||
| .use(initReactI18next) | ||
| .init({ | ||
| resources: { | ||
| en: { translation: enTranslations }, | ||
| it: { translation: itTranslations }, | ||
| nl: { translation: nlTranslations } | ||
| }, | ||
| lng: 'en', | ||
| fallbackLng: 'en', | ||
| interpolation: { | ||
| escapeValue: false | ||
| } | ||
| }) | ||
|
|
||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "welcomeToAlbatross": "Welcome to Albatross", | ||
| "applicationLogoAlt": "Application logo - albatross flying", | ||
| "openOrCreateDocument": "Open an existing document or create a new one", | ||
| "new": "New", | ||
| "samplePlot": "Sample plot", | ||
| "open": "Open", | ||
| "branch": "Branch", | ||
| "build": "Build", | ||
| "unknown": "unknown" | ||
| } |
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,11 @@ | ||
| { | ||
| "welcomeToAlbatross": "Benvenuto in Albatross", | ||
| "applicationLogoAlt": "Logo dell'applicazione - albatross in volo", | ||
| "openOrCreateDocument": "Apri un documento esistente o creane uno nuovo", | ||
| "new": "Nuovo", | ||
| "samplePlot": "Grafico di esempio", | ||
| "open": "Apri", | ||
| "branch": "Ramo", | ||
| "build": "Compilazione", | ||
| "unknown": "sconosciuto" | ||
| } |
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,11 @@ | ||
| { | ||
| "welcomeToAlbatross": "Welkom bij Albatross", | ||
| "applicationLogoAlt": "Applicatielogo - vliegende albatros", | ||
| "openOrCreateDocument": "Open een bestaand document of maak een nieuw document", | ||
| "new": "Nieuw", | ||
| "samplePlot": "Voorbeeldgrafiek", | ||
| "open": "Openen", | ||
| "branch": "Tak", | ||
| "build": "Build", | ||
| "unknown": "onbekend" | ||
| } |
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
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.
[nitpick] The LanguageSelector component does not include an option for Dutch ('nl') despite the i18n configuration providing Dutch translations. Consider adding a Dutch option to align with the available languages.