Skip to content
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

feat(i18n): save and load locale from redux store #1723

Merged
merged 23 commits into from
May 28, 2021
Merged

Conversation

justindomingue
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented May 27, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/uniswap/uniswap-interface/Gc9nfRZTXU8NBbRJkMb1BZ4d72sJ
✅ Preview: https://uniswap-interface-git-lingui-redu-uniswap.vercel.app

@justindomingue justindomingue requested a review from moodysalem May 27, 2021 17:30
Copy link
Contributor

@moodysalem moodysalem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you merge main so the deleted files are removed from the diff?

Copy link
Contributor

@moodysalem moodysalem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one more important change (order of preference)

src/i18n.tsx Outdated
const [language, region] = navigator.language.split('-')

if (region) {
return parseLocale(`${language}-${region}`) ?? parseLocale(language)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

region.toUpperCase()

Note that in Safari on iOS prior to 10.2, the country code returned is lowercase: "en-us", "fr-fr" etc.

https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/language

@justindomingue justindomingue merged commit 04878e0 into main May 28, 2021
@justindomingue justindomingue deleted the lingui-redu branch May 28, 2021 16:03
daniel-dev1990 pushed a commit to daniel-dev1990/uniswap-interface that referenced this pull request Jul 8, 2021
* wrap sock around function component to get re-renders

* removed sourcelocale since we are using custom ids

* load locale data dynamically

* undo dev change

* ran yarn i18n:extract

* store locale in redux

* added support for redux

* restored header

* refactor

* addressed pr feedback

* specify type

* added navigator locale fallback to generic dialect

* make locale array const and typed

* addressed pr feedback

* fixed various

* addressed pr feedback

* make supported locales constant uppercase

* add back toUpperCase removed during refactoring

* removed lingui/detect-locale

* run yarn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants