-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Feature/implement i18n for Dashboard and SideBar #50626
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/implement i18n for Dashboard and SideBar #50626
Conversation
c7ee6d6 to
d930653
Compare
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.
Nice, thanks for the pull request.
Maybe we can introduce i18n for the full application but only in english.
And then in a second different PR the full traduction for chinese ?
This will separate the discussions from introducing an i18n structure in the project vs Specific Terminology Translations for chinese.
I am not super confortable merging a PR that will partially have english and chinese implemented, with places not using i18n at all and other places that do.
Also we might want to check pluralize function. (That will most likely need to be adapted)
|
Hi @pierrejeambrun , Thanks for your guidance and the clear path forward! I completely agree that separating the "Terminology Translations for Chinese" into a distinct PR is the best approach. However, in my opinion, temporarily retaining the "Traditional Chinese" option in the language switcher might be beneficial. If What are your thoughts on this specific point about retaining the switcher option for review? Please let me know how you'd like me to proceed regarding the visibility of the Thanks! |
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.
This is a solid start. Thanks so much for taking this on!
Do we need to manually handle the user's preferred language in localStorage I thought react-i18next already handles that?
We should look into linting tools to detect when we have any hardcoded strings or if a translation file is missing any entries: https://www.npmjs.com/package/eslint-plugin-i18next. We can have them warn for now and switch to error when ready.
I also want to look more into Shopify's formats. They seem to have good pluralization rules: https://github.com/Shopify/i18next-shopify
airflow-core/src/airflow/ui/src/pages/Dashboard/HistoricalMetrics/TaskInstanceMetrics.tsx
Outdated
Show resolved
Hide resolved
|
Actually, I think I'm leaning towards Pierre's side now. I would like to encourage discussion on how to translate Airflow topics separate from the system setup. We can fully test the switching languages in that second PR too. Filling in every spot that's missing will still take time and we can add that linting rule in later too #protm |
Lee-W
left a comment
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 can't really help with the frontend side, but I can contribute to the discussion on the translation side
airflow-core/src/airflow/ui/src/i18n/locales/zh_TW/dashboard.json
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/ui/src/i18n/locales/zh_TW/dashboard.json
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/ui/src/i18n/locales/zh_TW/dashboard.json
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/ui/src/i18n/locales/zh_TW/dashboard.json
Outdated
Show resolved
Hide resolved
|
@josix I know you have been working on Python translation for a long time and understand Airflow well. Would you be interested in helping on this and the following ones 🙂 |
… Sorting Selector
Update: Fully implemented i18n for Nav Bar and dashboard.i18n-nav-and-home.mp4 |
|
Very cool! Looking forward to contribute German translation! |
I can help with Mandarin 🙂 |
airflow-core/src/airflow/ui/src/components/Assets/AssetEvent.tsx
Outdated
Show resolved
Hide resolved
After this PR we should add two linting rules:
I also like the idea of CODEOWNERS. Perhaps we should go as far as to make sure someone is willing to be a CODEOWNER to maintain a language before we accept a new one? |
Mhm, if we have 15 languages and you add some small piece to a screen this would be a blocker if you need to take care for translations prior merge. That would slow-down a lot of UI changes. I assume at least this needs to be satisfied for PRs that are back-ported (in future to 3.1) or before a release is made to close all translation gaps. Ah, but you say "Warning" not a blocking check... this is OK!
So raise my hand for German. |
|
If there's anything I can help with translating Korean, I'd love to participate! 🙌 |
Yes just a warning, do not block, if a language is missing a translation after we added a new feature. |
bbovenzi
left a comment
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.
This looks like a good start to me. Great work!
I made some sub-issues to handle linting and codeowners. After those we can start work on adding more languages
* pnpm add i18next react-i18next i18next-browser-languagedetector * feat(ui): set up i18n infrastructure * implement translations in user settings * fix(ui): improve language submenu interaction in UserSettings * feat(ui): implement i18n for Nav * feat(ui): i18n for Dashboard (Phase 1) * fix: add queued Dags * implement translations for states * fix: switched DAG to Dag, modified translations * feat(i18n): Implement pluralization for task instances, DAG runs, and asset events * feat(UI): Implement i18n in History TimeRangeSelector and Asset Event Sorting Selector * feat(UI): Implement i18n for Nav Bar * fix: Fully implement i18n for Nav Bar * fix: Remove explicit spacing in AssEvent Text * fix: handle noAssetEvents * UI: implement RadioItemGroup
* pnpm add i18next react-i18next i18next-browser-languagedetector * feat(ui): set up i18n infrastructure * implement translations in user settings * fix(ui): improve language submenu interaction in UserSettings * feat(ui): implement i18n for Nav * feat(ui): i18n for Dashboard (Phase 1) * fix: add queued Dags * implement translations for states * fix: switched DAG to Dag, modified translations * feat(i18n): Implement pluralization for task instances, DAG runs, and asset events * feat(UI): Implement i18n in History TimeRangeSelector and Asset Event Sorting Selector * feat(UI): Implement i18n for Nav Bar * fix: Fully implement i18n for Nav Bar * fix: Remove explicit spacing in AssEvent Text * fix: handle noAssetEvents * UI: implement RadioItemGroup
* pnpm add i18next react-i18next i18next-browser-languagedetector * feat(ui): set up i18n infrastructure * implement translations in user settings * fix(ui): improve language submenu interaction in UserSettings * feat(ui): implement i18n for Nav * feat(ui): i18n for Dashboard (Phase 1) * fix: add queued Dags * implement translations for states * fix: switched DAG to Dag, modified translations * feat(i18n): Implement pluralization for task instances, DAG runs, and asset events * feat(UI): Implement i18n in History TimeRangeSelector and Asset Event Sorting Selector * feat(UI): Implement i18n for Nav Bar * fix: Fully implement i18n for Nav Bar * fix: Remove explicit spacing in AssEvent Text * fix: handle noAssetEvents * UI: implement RadioItemGroup

Related Issue
#9864
cc: @bbovenzi
Summary
This is the initial phase of internationalization (i18n) for the Dashboard and Navigation (Nav) components.
Changes Made
react-i18nextto enable translation of static text.i18next-browser-languagedetector:localStorage.DashboardandNavsections to utilize theuseTranslationhook and thetranslate()function for rendering localized text.i18n file structure
Screen recording
i18n-demo.mp4
Future Work
This submission represents the first step in internationalizing these UI areas. Several more complex translation tasks are planned for subsequent PRs:
statesin Runs and TIs .i18next-http-backend) to improve initial application load times, especially as more languages are added.Points for Discussion
As this is an initial step towards comprehensive UI internationalization, I would appreciate community feedback and discussion on the following topics to ensure the approach aligns with project standards and future needs:
The current implementation uses JSON files.(Note:
i18next-http-backendexpects JSON as its default resource format) Are there any preferences or established best practices within the Airflow community for this format, or should alternatives be considered?The current "Select Language" icon is same as the "Browse" icon. I'm open to suggestions from the project's available icon sets.
For certain domain-specific terms (e.g., "Pool Slots"), arriving at an accurate translation can be challenging. I've made initial translations but would welcome discussion to establish a consensus for such terms. (需要懂繁體中文的人幫忙!)
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.