add i18next and config for i18n of UI#2254
Conversation
d98f5cf to
be75a05
Compare
be75a05 to
44867d8
Compare
| { | ||
| "dependencies": { | ||
| "@types/react": "^18.0.25", | ||
| "i18next": "^22.0.6", | ||
| "i18next-browser-languagedetector": "^7.0.1", | ||
| "react-i18next": "^12.0.0" | ||
| } | ||
| } |
There was a problem hiding this comment.
This should be inside the existing package.json file inside the 'web` directory.
Just add these to the file:
"i18next": "^22.0.6",
"i18next-browser-languagedetector": "^7.0.1",
"react-i18next": "^12.0.0"
and run npm i
There was a problem hiding this comment.
This file along with the lock file should then be deleted.
| } | ||
| }); | ||
|
|
||
| export default i18n; No newline at end of file |
There was a problem hiding this comment.
You can apply formatting by running npm run eslint-fix that will cleanup newline issues like this.
There was a problem hiding this comment.
ran eslint with npx, think I resolved this
| @@ -0,0 +1,46 @@ | |||
| import i18n from 'i18next'; | |||
There was a problem hiding this comment.
Can you make this a TypeScript file? End it with the *.ts instead of the JavaScript extension.
44867d8 to
1f2506c
Compare
Codecov Report
@@ Coverage Diff @@
## main #2254 +/- ##
=========================================
Coverage 77.01% 77.01%
Complexity 1166 1166
=========================================
Files 222 222
Lines 5307 5307
Branches 424 424
=========================================
Hits 4087 4087
Misses 747 747
Partials 473 473 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
0a368ca to
5c6e024
Compare
|
@phixMe reverting to |
18d2687 to
5997e68
Compare
|
When the translation is longer than the original, the effect is not great, unfortunately. But there's no reason to assume these "translations" (from Google) are worth keeping. @julienledem @mobuchowski would you please review? |
| jobs: 'Pracy', | ||
| and: 'i', | ||
| datasets: 'Zestawy Danych' | ||
| } |
There was a problem hiding this comment.
I think we need to agree on run, job, dataset translations. IMO
RUN: wykonanie (as in "wykonanie zadania")
JOB: zadanie
DATASET: zbiór danych
I think only wykonanie might be controversial - it translates more to execution, but I don't have better idea. Bieg or przebieg make sense only as the sport IMO.
then:
docs_link: Dokumentacja API
latest_tab: OSTATNIE WYKONANIE
history tab: HISTORIA WYKONAŃ
location: LOKALIZACJA
empty_title: Brak dostępnych informacji o wykonaniu
empty_body: Spróbuj dodać kilka wykonań dla tego zadania
search: Wyszukiwanie
jobs: Zadania
and: i
datasets: Zbiory Danych
Still, translations of "computer concepts" will always sound awkward in Polish for me.
There was a problem hiding this comment.
thank you, @mobuchowski . @pawel-big-lebowski @JDarDagran @tnazarew WDYT?
There was a problem hiding this comment.
I'd say wykonanie sounds more natural to me. We shouldn't be so strict about translating this one to one. Job and dataset are just right.
There was a problem hiding this comment.
Thanks, @mobuchowski and @JDarDagran . I've revised the translations.
|
Does it add an option to switch language or does it force a translation based on something like browser language? I think it would be great to have language switcher if we do something like it. |
|
@mobuchowski i18next does support a language-switcher setup, but that route is a bit more labor-intensive. |
52dac32 to
3745a7e
Compare
|
@phixMe To translate the text in web/src/components/lineage/Lineage.tsx I did a workaround that required changing the tsconfig.json to set 'noImplicitAny' to 'false'. The initial problem was that there doesn't seem to be any way to use the |
| "webpack-merge": "^4.2.1", | ||
| "i18next": "^22.0.6", | ||
| "i18next-browser-languagedetector": "^7.0.1", | ||
| "react-i18next": "^12.0.0" |
There was a problem hiding this comment.
There should be an update to the lock file in this directory.
| import Node from './components/node/Node' | ||
| import ParentSize from '@visx/responsive/lib/components/ParentSize' | ||
| import { useTranslation } from 'react-i18next' | ||
| import i18next from '../../i18n' |
There was a problem hiding this comment.
@merobi-hub I think you don't want to be importing this here. This should be your type issue for no-implicit-any
| "resolveJsonModule": true | ||
| }, | ||
| "include": ["./src/**/*"], | ||
| "exclude": ["./src/__tests__/*"] |
There was a problem hiding this comment.
Can we do without these config changes now? Implicit any in TypeScript is not the best rule to have disabled.
| proxy: { | ||
| '/api': { | ||
| target: `http://${process.env.MARQUEZ_HOST || 'localhost'}:${process.env.MARQUEZ_PORT || 8080}/`, | ||
| target: `http://${process.env.MARQUEZ_HOST || 'localhost'}:${process.env.MARQUEZ_PORT || 5000}/`, |
There was a problem hiding this comment.
I think we don't want this change committed.
There was a problem hiding this comment.
where's the facepalm emoji? (reverted this)
Signed-off-by: Michael Robinson <merobi@gmail.com>
…to ui/add-i18next Signed-off-by: Michael Robinson <merobi@gmail.com>
4820353 to
1f322b1
Compare
Signed-off-by: Michael Robinson <merobi@gmail.com>
Signed-off-by: Michael Robinson <merobi@gmail.com>
Signed-off-by: Michael Robinson <merobi@gmail.com>
b5ea8ea to
854d863
Compare
Signed-off-by: Michael Robinson <merobi@gmail.com>
|
@phixMe I believe this is RFR again. I added some missing translations I found, caught up to the new Events route and reverted the configuration changes. See the screenshots for what it looks like. |
# Conflicts: # web/package-lock.json # web/src/components/header/Header.tsx # web/src/components/jobs/JobDetailPage.tsx # web/src/components/jobs/RunInfo.tsx # web/src/components/jobs/Runs.tsx # web/src/components/lineage/Lineage.tsx # web/src/components/search/SearchPlaceholder.tsx # web/src/components/sidenav/Sidenav.tsx # web/src/i18n/config.ts # web/src/types/i18next.d.ts # web/tsconfig.json
Signed-off-by: Michael Robinson <merobi@gmail.com>
|
@phixMe This is RFR. Added a reload after a language change and fixed the reloading issue so the new language setting persists. |
Signed-off-by: Michael Robinson <merobi@gmail.com>
a1d7c8e to
be600e7
Compare
Signed-off-by: Michael Robinson <merobi@gmail.com>
be600e7 to
287ba68
Compare
|
OK, now this is actually RFR @phixMe |
phixMe
left a comment
There was a problem hiding this comment.
Looks great @merobi-hub. Thanks for the contribution.
| src="https://raw.githubusercontent.com/MarquezProject/marquez/main/web/src/img/iconSearchArrow.svg" | ||
| width={'30px'} | ||
| /> | ||
| <SVG src='../../img/iconSearchArrow.svg' width={'30px'} /> |
Signed-off-by: Michael Robinson <merobi@gmail.com> Co-authored-by: Peter Hicks <phixMe@users.noreply.github.com> Co-authored-by: phix <peter.hicks@astronomer.io>








Signed-off-by: Michael Robinson merobi@gmail.com
Problem
Internationalization is strongly recommended by the LFAI (in the CII Silver Badge). The UI is not currently internationalized.
Closes: #ISSUE-NUMBER
Solution
This change adds i18next, configures it, and edits the text to make use of the tool's translation capabilities.
Checklist
CHANGELOG.mdwith details about your change under the "Unreleased" section (if relevant, depending on the change, this may not be necessary).sqldatabase schema migration according to Flyway's naming convention (if relevant)