# encoding: UTF-8 require 'test_helper' require 'i18n' require 'stringex' class GermanYAMLLocalizationTest < Test::Unit::TestCase def setup Stringex::Localization.reset! Stringex::Localization.backend = :i18n Stringex::Localization.backend.load_translations :de Stringex::Localization.locale = :de end { "foo & bar" => "foo und bar", "AT&T" => "AT und T", "99° sind normal" => "99 Grad sind normal", "4 ÷ 2 ist 2" => "4 geteilt durch 2 ist 2", "webcrawler.com" => "webcrawler Punkt com", "Nun..." => "Nun Punkt Punkt Punkt", "x=1" => "x gleich 1", "Ein #2 Stift" => "Ein Nummer 2 Stift", "100%" => "100 Prozent", "Kosten+Steuern" => "Kosten plus Steuern", "Batman/Robin Fan Fiction" => "Batman Strich Robin Fan Fiction", "Wähle *69" => "Wähle Stern 69", " i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged " }.each do |original, converted| define_method "test_character_conversion: '#{original}'" do assert_equal converted, original.convert_miscellaneous_characters end end { "$100" => "100 Dollar", "$19.99" => "19 Dollar 99 Cent", "£100" => "100 Pfund", "£19.99" => "19 Pfund 99 Pence", "€100" => "100 Euro", "€19.99" => "19 Euro 99 Cent", "¥1000" => "1000 Yen" }.each do |original, converted| define_method "test_currency_conversion: '#{original}'" do assert_equal converted, original.convert_miscellaneous_characters end end { "Hennes & Mauritz" => "Hennes und Mauritz", "10¢" => "10 Cent", "©2000" => "(C)2000", "98° sind ok" => "98 Grad sind ok", "10÷5" => "10 geteilt durch 5", ""zitiert"" => '"zitiert"', "Fortsetzung folgt…" => "Fortsetzung folgt...", "2000–2004" => "2000-2004", "Ich wünschte—oh, ach nichts" => "Ich wünschte--oh, ach nichts", "½ Unze Gold" => "halbe(r) Unze Gold", "1 und ¼ Unzen Silber" => "1 und ein Viertel Unzen Silber", "9 und ¾ Unzen Platin" => "9 und drei Viertel Unzen Platin", "3>2" => "3>2", "2<3" => "2<3", "zwei Worte" => "zwei Worte", "100£" => "100 Pfund", "Walmart®" => "Walmart(R)", "'einfach zitiert'" => "'einfach zitiert'", "2×4" => "2x4", "Programming™" => "Programming(TM)", "20000¥" => "20000 Yen", " i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged " }.each do |original, converted| define_method "test_html_entity_conversion: '#{original}'" do assert_equal converted, original.convert_miscellaneous_html_entities end end { "½" => "halbe(r)", "½" => "halbe(r)", "½" => "halbe(r)", "⅓" => "ein Drittel", "⅓" => "ein Drittel", "⅔" => "zwei Drittel", "⅔" => "zwei Drittel", "¼" => "ein Viertel", "¼" => "ein Viertel", "¼" => "ein Viertel", "¾" => "drei Viertel", "¾" => "drei Viertel", "¾" => "drei Viertel", "⅕" => "ein Fünftel", "⅕" => "ein Fünftel", "⅖" => "zwei Fünftel", "⅖" => "zwei Fünftel", "⅗" => "drei Fünftel", "⅗" => "drei Fünftel", "⅘" => "vier Fünftel", "⅘" => "vier Fünftel", "⅙" => "ein Sechstel", "⅙" => "ein Sechstel", "⅚" => "fünf Sechstel", "⅚" => "fünf Sechstel", "⅛" => "ein Achtel", "⅛" => "ein Achtel", "⅜" => "drei Achtel", "⅜" => "drei Achtel", "⅝" => "fünf Achtel", "⅝" => "fünf Achtel", "⅞" => "sieben Achtel", "⅞" => "sieben Achtel" }.each do |original, converted| define_method "test_vulgar_fractions_conversion: #{original}" do assert_equal converted, original.convert_vulgar_fractions end end end