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

Don’t load translations if they don't exist #738

Merged
merged 4 commits into from
Jun 5, 2019

Conversation

lemonmade
Copy link
Member

Our current Babel transform attempts to return the result of importing import('./translations/${locale}'). This works fine, but means that for any locale other than the fallback, we always try to load that file. This is useless for locales like en-CA, where we do not provide explicit translations and instead just use an en.json. For those, it's just wasted bandwidth.

This PR fixes this issue by reading the translations that are available for a component, and bailing immediately if the requested locale is not one of those.

@lemonmade
Copy link
Member Author

cc/ @rexmac and @qq99 who brought this up 🥇

Copy link
Contributor

@marutypes marutypes left a comment

Choose a reason for hiding this comment

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

🏅❤️

yarn.lock Outdated Show resolved Hide resolved
Copy link
Member

@GoodForOneFare GoodForOneFare left a comment

Choose a reason for hiding this comment

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

👍

@lemonmade lemonmade merged commit afd9273 into master Jun 5, 2019
@lemonmade lemonmade deleted the dont-load-nonexistant-translations branch February 7, 2020 17:17
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.

None yet

4 participants