# encoding: UTF-8 require 'test_helper' require 'i18n' require 'stringex' class DutchYAMLLocalizationTest < Test::Unit::TestCase def setup Stringex::Localization.reset! Stringex::Localization.backend = :i18n Stringex::Localization.backend.load_translations :nl Stringex::Localization.locale = :nl end { "foo & bar" => "foo en bar", "AT&T" => "AT en T", "99° is normaal" => "99 graden is normaal", "4 ÷ 2 is 2" => "4 gedeeld door 2 is 2", "webcrawler.com" => "webcrawler punt com", "Dus..." => "Dus punt punt punt", "x=1" => "x is 1", "Een potlood #2" => "Een potlood nummer 2", "100%" => "100 procent", "prijs+belasting" => "prijs plus belasting", "Batman/Robin fan fiction" => "Batman slash Robin fan fiction", "bel *69" => "bel ster 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 { "¤20" => "20 euro", "$100" => "100 dollar", "$19.99" => "19 dollar 99 cent", "£100" => "100 pond", "£19.99" => "19 pond 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 { "Appels & peren" => "Appels en peren", "10¢" => "10 cent", "©2000" => "(c)2000", "98° is acceptabel" => "98 graden is acceptabel", "10÷5" => "10 gedeeld door 5", ""tussen aanhalingstekens"" => '"tussen aanhalingstekens"', "wordt vervolgd…" => "wordt vervolgd...", "2000–2004" => "2000-2004", "Ik wil—oh, laat maar" => "Ik wil--oh, laat maar", "½ ons goud" => "half ons goud", "1 en ¼ ons zilver" => "1 en eenvierde ons zilver", "9 en ¾ ons platina" => "9 en drievierde ons platina", "3>2" => "3>2", "2<3" => "2<3", "twee woorden" => "twee woorden", "100£" => "100 pond", "Walmart®" => "Walmart(r)", "'enkele aanhalingstekens'" => "'enkele aanhalingstekens'", "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 { "½" => "half", "½" => "half", "½" => "half", "⅓" => "eenderde", "⅓" => "eenderde", "⅔" => "tweederde", "⅔" => "tweederde", "¼" => "eenvierde", "¼" => "eenvierde", "¼" => "eenvierde", "¾" => "drievierde", "¾" => "drievierde", "¾" => "drievierde", "⅕" => "eenvijfde", "⅕" => "eenvijfde", "⅖" => "tweevijfde", "⅖" => "tweevijfde", "⅗" => "drievijfde", "⅗" => "drievijfde", "⅘" => "viervijfde", "⅘" => "viervijfde", "⅙" => "eenzesde", "⅙" => "eenzesde", "⅚" => "vijfzesde", "⅚" => "vijfzesde", "⅛" => "eenachtste", "⅛" => "eenachtste", "⅜" => "drieachtste", "⅜" => "drieachtste", "⅝" => "vijfachtste", "⅝" => "vijfachtste", "⅞" => "zevenachtste", "⅞" => "zevenachtste" }.each do |original, converted| define_method "test_vulgar_fractions_conversion: #{original}" do assert_equal converted, original.convert_vulgar_fractions end end end