Closed beauraF closed 2 years ago
Hi!
Are you by any chance using bootsnap? I have a very similar issue, albeit without using custom transliterations (only rails-i18n
). It seems updating i18n
from 1.8.11 to 1.9.1 while using bootsnap broke something:
assert_equal({ :ä => "ae", :é => "e", :ü => "ue", :ö => "oe", :Ä => "Ae", :Ü => "Ue", :Ö => "Oe", :ß => "ss" }, I18n.t("i18n.transliterate.rule", locale: :de))
OK for 1.8.11 without bootsnap OK for 1.8.11 with bootsnap OK for 1.9.1 without bootsnap Breaks for 1.9.1 with bootsnap:
Failure:
ApplicationHelperTest#test_all_countries_:de [/private/tmp/transliterate-bug/test/helpers/application_helper_test.rb:5]:
--- expected
+++ actual
@@ -1 +1 @@
-{:ä=>"ae", :é=>"e", :ü=>"ue", :ö=>"oe", :Ä=>"Ae", :Ü=>"Ue", :Ö=>"Oe", :ß=>"ss"}
+{:"\xC3\xA4"=>"ae", :"\xC3\xA9"=>"e", :"\xC3\xBC"=>"ue", :"\xC3\xB6"=>"oe", :"\xC3\x84"=>"Ae", :"\xC3\x9C"=>"Ue", :"\xC3\x96"=>"Oe", :"\xC3\x9F"=>"ss"}
I made a demo repository with a rails new --minimal
, a single test file and branches for each combination of i18n version and bootsnap enabled/disabled:
https://github.com/lorenzk/i18n-transliterate-bug/pulls
Sorry, I just realized that my problem is a duplicate of https://github.com/ruby-i18n/i18n/issues/606
Oh, it seems mine too. I missed it. Thanks @lorenzk for pointing it out. :)
Hello 👋
We are using custom rules for transliteration. Since https://github.com/ruby-i18n/i18n/pull/587 they are not taking into account anymore. It seems that this is due to the fact that
symbolize_names
returns keys withASCII-8BIT
encoding :This is what
@approximations
contains in ourHashTransliterator
:What I tried to do
What I expected to happen
What actually happened
Versions of i18n, rails, and anything else you think is necessary