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

Display language name or language key #2949

Merged
merged 7 commits into from
Oct 10, 2018
Merged

Conversation

voodoorai2000
Copy link
Member

What

  • 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

Notes

Solution based on recent comments on a related I18n issue

Another PR on the way with language names for all locales

@voodoorai2000 voodoorai2000 changed the title Display language name or language key [WIP] Display language name or language key Oct 4, 2018
@voodoorai2000 voodoorai2000 changed the title [WIP] Display language name or language key Display language name or language key Oct 4, 2018
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=
@voodoorai2000 voodoorai2000 self-assigned this Oct 10, 2018
@voodoorai2000 voodoorai2000 merged commit 710e5ae into master Oct 10, 2018
@voodoorai2000 voodoorai2000 deleted the i18n-language-names branch October 10, 2018 09:45
@voodoorai2000 voodoorai2000 added this to Review in Roadmap Oct 17, 2018
@voodoorai2000 voodoorai2000 moved this from Review to Release 0.17 in Roadmap Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants