# encoding: UTF-8 require 'test_helper' require 'i18n' require 'stringex' class DanishYAMLLocalizationTest < Test::Unit::TestCase def setup Stringex::Localization.reset! Stringex::Localization.backend = :i18n Stringex::Localization.backend.load_translations :da Stringex::Localization.locale = :da end { "foo & bar" => "foo og bar", "AT&T" => "AT og T", "99° is normal" => "99 grader is normal", "4 ÷ 2 is 2" => "4 divideret med 2 is 2", "webcrawler.com" => "webcrawler punktum com", "Well..." => "Well prik prik prik", "x=1" => "x lig med 1", "a #2 pencil" => "a nummer 2 pencil", "100%" => "100 procent", "cost+tax" => "cost plus tax", "batman/robin fan fiction" => "batman skråstreg robin fan fiction", "dial *69" => "dial stjerne 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 kroner", "$100" => "100 dollars", "$19.99" => "19 dollars 99 cents", "£100" => "100 pund", "£19.99" => "19 pund 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 { "Tea & Sympathy" => "Tea og Sympathy", "10¢" => "10 cents", "©2000" => "(c)2000", "98° is fine" => "98 grader is fine", "10÷5" => "10 divideret med 5", ""quoted"" => '"quoted"', "to be continued…" => "to be continued...", "2000–2004" => "2000-2004", "I wish—oh, never mind" => "I wish--oh, never mind", "½ ounce of gold" => "halv ounce of gold", "1 and ¼ ounces of silver" => "1 and en fjerdedel ounces of silver", "9 and ¾ ounces of platinum" => "9 and tre fjerdedele ounces of platinum", "3>2" => "3>2", "2<3" => "2<3", "two words" => "two words", "£100" => "pund 100", "Walmart®" => "Walmart(r)", "'single quoted'" => "'single quoted'", "2×4" => "2x4", "Programming™" => "Programming(tm)", "¥20000" => "yen 20000", " 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 { "½" => "halv", "½" => "halv", "½" => "halv", "⅓" => "en tredjedel", "⅓" => "en tredjedel", "⅔" => "to tredjedele", "⅔" => "to tredjedele", "¼" => "en fjerdedel", "¼" => "en fjerdedel", "¼" => "en fjerdedel", "¾" => "tre fjerdedele", "¾" => "tre fjerdedele", "¾" => "tre fjerdedele", "⅕" => "en femtedel", "⅕" => "en femtedel", "⅖" => "to femtedele", "⅖" => "to femtedele", "⅗" => "tre femtedele", "⅗" => "tre femtedele", "⅘" => "fire femtedele", "⅘" => "fire femtedele", "⅙" => "en sjettedel", "⅙" => "en sjettedel", "⅚" => "fem sjettedele", "⅚" => "fem sjettedele", "⅛" => "en ottendedel", "⅛" => "en ottendedel", "⅜" => "tre ottendedele", "⅜" => "tre ottendedele", "⅝" => "fem ottendedele", "⅝" => "fem ottendedele", "⅞" => "syv ottendedele", "⅞" => "syv ottendedele" }.each do |original, converted| define_method "test_vulgar_fractions_conversion: #{original}" do assert_equal converted, original.convert_vulgar_fractions end end end