airflow
airflow copied to clipboard
i18n: Move translations to `ui/public` and enable dynamic loading to reduce bundle size
Summary
- Moved all translation (i18n) files from
ui/src/i18n/localestoui/public/i18n/locales. - Adopted
i18next-http-backendto load translation files via HTTP dynamically. - Updated FastAPI static file serving logic to ensure translation files are accessible in both dev and prod environments.
- Unified i18next
loadPathto/static/i18n/locales/{{lng}}/{{ns}}.jsonfor both environments.
- Unified i18next
- Improved maintainability and scalability of the i18n system.
Details
- i18next-http-backend allows translation files to be loaded on demand, reducing the initial bundle size and supporting dynamic language/namespace loading.
- FastAPI dev mode now mounts the public i18n directory to
/static/i18n, ensuring translation files are served correctly during development. - Production mode continues to serve translation files from the built
distdirectory. - The i18n config (
config.ts) was updated to use a unified HTTP path for translation files, simplifying the frontend logic.
Breaking Changes
- If we have custom scripts or tools that expect translation files in
src, please update them to use the new location inpublic/i18n/locales.
closes: #51123
Opened a new PR to avoid potential issues with translation file conflicts in the previous one. Sorry for the inconvenience.
^ 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.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.