-
Notifications
You must be signed in to change notification settings - Fork 145
feat: internationalization #6198
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
base: develop
Are you sure you want to change the base?
feat: internationalization #6198
Conversation
* Updated lingui dependencies to the latest versions. * Added eslint-plugin-lingui to prevent some issues. * Fixed problems introduced when updated lingui dependencies.
* New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update source file en-US.po
* Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian)
* New translations en-us.po (Spanish) * New translations en-us.po (Spanish)
* feat: add basic languages dropdown * feat: add languages dropdown with labels and flags * feat: store language when language is switched * chore: remove deprecated functions * fix: top menu not updating * fix: strings not updating when language changes * fix: strings not updating when language changes * fix: remove lingui usage from footer
* New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update apps/cowswap-frontend/src/locales/ru-RU.po Co-authored-by: Copilot <[email protected]> * Update apps/cowswap-frontend/src/locales/es-ES.po Co-authored-by: Copilot <[email protected]> * Update apps/cowswap-frontend/src/locales/ru-RU.po Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
* New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian)
* Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian)
* New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian)
|
Hey @elena-zh , thanks for the new review. We're getting there, I think. Also thanks for the testing accounts, they were very useful. I worked on the issues you sent, and also merged the latest changes from develop, fixed conflicts, added some new localizations, etc. It's somewhat hard to keep the localizations up to date when the app's text is constantly being modified (which is inevitable, this PR modified pretty much the whole app), but oh well... I hope I didn't miss any new localizations. About the issues: These have some comments from me
I reverted this to the previous state.
I'm pretty sure this particular piece of code is shared across the app, so it should reverted here as well (please let me know if it isn't).
I'm having some trouble with this. Every row is a separate entity, unaware of what the other rows are showing and their individual columns' width. So if I change a column's width or any properties, they change for all of them. So: all the widths are pre-set, and there's already a min / max width for all the columns except the last one (it's the way it was originally implemented). If I modify this particular column's width to something more "generous", this is what happens (columns min/max width varies more, so each row is visibly different now).
I think some possible solutions to this could be:
Anyways, this is what I could come up with modifying as little code as possible. It works, but it's brittle: extremely long words could break it or make it look funny:
Fixed. Sometimes Crowdin does that (breaking tags in translations), I don't know why.
Fixed. Crowdin didn't translate some of the words.
This error message is coming from the wallet, I tried rejecting the connection with a few different ones and the message changes. In other words: we can't translate it. Also, it shows different messages for different errors. Maybe it can be handled somehow, but I'm not sure about the way to do that. These should be fixed, no comments:
Fixed
Fixed
Fixed
Fixed
Fixed
Fixed
Fixed |
* New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian)
|
Hey @gabitoesmiapodo , I've done another test round, and here are some more notpicks that I've noticed:
Why not moving it to here?
As far as I can see, there should be enough space to display a longer value Thank you |
* New translations en-us.po (Russian) * New translations en-us.po (Spanish) * New translations en-us.po (Russian) * Update source file en-US.po * New translations en-us.po (Spanish) * New translations en-us.po (Russian)
|
Hey @elena-zh , here are the fixes.
Added the new translations.
Crowdin missed that, so I made it translate it.
There was an issue with the way I placed the localization macros and some hardcoded spaces, let me know if it's better now.
Another Crowdin miss, probably didn't know what word to use (and probably still doesn't).
Should be fixed.
I removed the period from the end of the sentence, but it seems that's the way the browser is rendering the date in Russian? English is Spanish is And Russian But anyways, I removed the period, it'll only show up in Russian because of the abbreviation.
Yeah, the wrapper changes width but also there's an extra icon there so if the word doesn't fit it breaks. That's why I suggested maybe tweaking the design a bit is the best option here. The best I could do for now is making the browser break words more gracefully using hypens.
Yep, our weekly "the new fix is also the new bug" contest. It should be aligned to the right now.
Fixed. Hopefully no regressions. |

















Summary
First, sorry for the huge PR... this involved changing a lot of files, mainly because I had to add Lingui macros to practically every string in the app.
This PR is related to RFP: Internationalization setup - Grant Application - Internationalization setup for swap.cow.fi
Deployed preview available at: https://cowswap-i18n.vercel.app/
Detailed setup and workflow documentation: Internationalization doc (gist)
Details:
Internationalization (i18n) Implementation
This PR introduces full internationalization support to the CowSwap app (
/apps/cowswap-frontend)Files in other apps or sites in the monorepo were not modified, unless unavoidable, e.g. the footer was not updated because other apps do not yet support i18n and this could introduce some problems. As a result, some text might still remain in English, this is expected.
The bulk of the changes were mainly adding Lingui macros to user-facing strings, and adapting the components where needed if Lingui's constraints made using available implementations impossible (e.g.: top-level strings are a no-go for Lingui).
Translations were performed by Crowdin (automatic translation), so they're not perfect. That will need more work from an expert in such matters.
Main changes
Lingui upgrade: Updated to the latest version and fixed all incompatibilities.
ESLint rules: Added rules for Lingui usage to prevent future issues.
Localization coverage: Ensured all user-facing strings in
cowswap-frontendare marked for translation.Languages enabled: Added support for
es-ES(Spanish) andru-RU(Russian). Russian was chosen to validate UI handling of longer/non-Latin text.Language switcher: Implemented a functional and styled dropdown to select languages. Language names are not translated.
Automatic detection: Detects browser locale and defaults to English when unsupported.
Persistence: Remembers user language selection per browser, without overwriting it with auto-detection.
Crowdin integration:
crowdin.ymlto the app.en-US.pochanges to translation files.Feature flag:
REACT_APP_LINGUI_INTERNATIONALIZATIONcontrols hiding / showing the system.Stable URLs regardless of selected language.
Screenshots:
Aug-28-2025.18-28-20.mp4
To Test
REACT_APP_LINGUI_INTERNATIONALIZATION=trueshould be added to see the dropdown