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

[Upstream] I18n language names #1665

Merged
merged 8 commits into from
Oct 17, 2018
Merged

[Upstream] I18n language names #1665

merged 8 commits into from
Oct 17, 2018

Conversation

voodoorai2000
Copy link
Member

References

consuldemocracy#2949

Objectives

  • Simplify I18n language name lookup
  • Display language name if translation exists
  • Display language key if translation does not exist
  • Removes obsolete language name keys
  • Adds missing language name keys

Visual Changes

Languages with and without translations
language names

There where two issues with the current implementation:

- There was a possible duplication between looking up the language name in key "locale" and in key "i18n.language.name"

- The "default" option was not being picked up, as the fallback always returned the default locale's translation, "English"

With this implementation there is only a single place to put the language name: i18n.language.name. I think this place is easier to find and understand for Crowdin translators than a "locale" key hidden in general.yml

If the translation is not found we display the language key, instead of English, which makes more sense to me too 😌

Solution based on recent comments[1] on a related I18n issue

[1] ruby-i18n/i18n#365 (comment)
Add i18n.yml to i18n task's available translation files
`I18n.available_locales=` does a little magic[1] and was causing some flakieness along the way, as the `:wl` locale persisted in future specs

Thanks for the heads up @javierm 👌

[1] https://www.rubydoc.info/github/svenfuchs/i18n/I18n%2FConfig:available_locales=
end

end
end

Choose a reason for hiding this comment

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

Layout/TrailingBlankLines: Final newline missing. (https://github.com/bbatsov/ruby-style-guide#newline-eof)

@voodoorai2000 voodoorai2000 changed the title [WIP] [Upstream] I18n language names [Upstream] I18n language names Oct 10, 2018
@voodoorai2000 voodoorai2000 merged commit 7f36b95 into master Oct 17, 2018
@voodoorai2000 voodoorai2000 deleted the i18n-language-names branch October 17, 2018 10:23
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