From 50eb7689c7d6339f8a28350d9ed3776e2626924a Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Tue, 12 Jun 2012 13:47:57 +0100 Subject: Fall back to "parent" locale names when deciding the localised language name. Fixes #503 --- lib/languages.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/languages.rb') diff --git a/lib/languages.rb b/lib/languages.rb index 474c0e0cb..4d355ab59 100644 --- a/lib/languages.rb +++ b/lib/languages.rb @@ -187,8 +187,9 @@ class LanguageNames 'za' => 'Saɯ cueŋƅ', 'zu' => 'isiZulu' } - - return language_names[locale] + locale = locale.sub("_", "-") + main_part = I18n::Locale::Tag::Simple.tag(locale).subtags[0] + return language_names[main_part] end end -- cgit v1.2.3 From 8f0b7b6f86dc60a51d4ffab2a5fd627fa3499b8a Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 13 Jun 2012 14:07:58 +0100 Subject: Fix it so we can correctly use and display locales that contain an underscore (e.g. `hu_HU`): * Use the latest version of `gettext_i18n_rails` (including fix to make it work in Railes 2.x) * Use a backend that falls back to, for example, `hu` from `hu_HU` (so we can use any underlying Rails l10n) * Normalize the underscore to a hyphen when working out which languages to display in the language switcher Fixes #503 (and see there for more discussion) --- lib/languages.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/languages.rb') diff --git a/lib/languages.rb b/lib/languages.rb index 4d355ab59..42231ef56 100644 --- a/lib/languages.rb +++ b/lib/languages.rb @@ -187,7 +187,7 @@ class LanguageNames 'za' => 'Saɯ cueŋƅ', 'zu' => 'isiZulu' } - locale = locale.sub("_", "-") + locale = locale.sub("_", "-") # normalize main_part = I18n::Locale::Tag::Simple.tag(locale).subtags[0] return language_names[main_part] end -- cgit v1.2.3