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

Fix didn't load zh_TW & zh_HK issue #45

Closed
wants to merge 1 commit into from
Closed

Conversation

pominx
Copy link

@pominx pominx commented May 24, 2019

In rails, I18n.locale is "zh-TW" & "zh-HK", which would not look into correct file in:

https://github.com/grosser/i18n_data/blob/master/lib/i18n_data.rb#L24

because "zh-TW" would not become "ZH_TW" (dash to underline).

Just let I18nData.countries('ZH_TW') can get correct data.

lib/i18n_data.rb Outdated
@@ -57,6 +57,8 @@ def fetch(type, language_code)
def normal_to_region_code(normal)
{
"ZH" => "zh_CN",
"ZH-HK" => "zh_HK",
"ZH-TW" => "zh_TW",
Copy link
Owner

Choose a reason for hiding this comment

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

  • this hash should be a constant
  • don't map these 1-off translations but use .tr('-', '_') so it works for everything
  • add a test

Copy link
Author

Choose a reason for hiding this comment

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

Hi @grosser , thank you for your reply, I already add a test and update the PR,
but I'm not familiar with Travis CI, would you help how to pass the test ? Thank you.

@grosser
Copy link
Owner

grosser commented May 24, 2019

try before_install: ruby -e "File.write('Gemfile.lock', File.read('Gemfile.lock').split('BUNDLED WITH').first)" in .travis.yml

@olleolleolle
Copy link
Contributor

@pominx Does this issue still cause you trouble? What happens if you rebase this on the default branch of this repo?

@grosser grosser closed this Dec 16, 2021
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.

3 participants