# encoding: UTF-8 require 'test_helper' require 'i18n' require 'stringex' class FrenchYAMLLocalizationTest < Test::Unit::TestCase def setup Stringex::Localization.reset! Stringex::Localization.backend = :i18n Stringex::Localization.backend.load_translations :fr Stringex::Localization.locale = :fr end { "foo & bar" => "foo et bar", "AT&T" => "AT et T", "99° est normal" => "99 degrés est normal", "4 ÷ 2 is 2" => "4 divisé par 2 is 2", "webcrawler.com" => "webcrawler point com", "Well..." => "Well point point point", "x=1" => "x égal 1", "a #2 pencil" => "a numéro 2 pencil", "100%" => "100 pourcent", "cost+tax" => "cost plus tax", "batman/robin fan fiction" => "batman slash robin fan fiction", "dial *69" => "dial étoile 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 livres", "$100" => "100 dollars", "$19.99" => "19 dollars 99 cents", "£100" => "100 livres", "£19.99" => "19 livres 99 pennies", "€100" => "100 euros", "€19.99" => "19 euros 99 cents", "¥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 et Sympathy", "10¢" => "10 cents", "©2000" => "(c)2000", "98° is fine" => "98 degrés is fine", "10÷5" => "10 divisé par 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" => "un demi ounce of gold", "1 et ¼ d'once de platinium" => "1 et un quart d'once de platinium", "9 et ¾ d'once de platinium" => "9 et trois quarts d'once de platinium", "3>2" => "3>2", "2<3" => "2<3", "two words" => "two words", "£100" => "livres 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 { "½" => "un demi", "½" => "un demi", "½" => "un demi", "⅓" => "un tiers", "⅓" => "un tiers", "⅔" => "deux tiers", "⅔" => "deux tiers", "¼" => "un quart", "¼" => "un quart", "¼" => "un quart", "¾" => "trois quarts", "¾" => "trois quarts", "¾" => "trois quarts", "⅕" => "un cinquième", "⅕" => "un cinquième", "⅖" => "deux cinquièmes", "⅖" => "deux cinquièmes", "⅗" => "trois cinquièmes", "⅗" => "trois cinquièmes", "⅘" => "quatre cinquièmes", "⅘" => "quatre cinquièmes", "⅙" => "un sixième", "⅙" => "un sixième", "⅚" => "cinq sixièmes", "⅚" => "cinq sixièmes", "⅛" => "un huitième", "⅛" => "un huitième", "⅜" => "trois huitièmes", "⅜" => "trois huitièmes", "⅝" => "cinq huitièmes", "⅝" => "cinq huitièmes", "⅞" => "sept huitièmes", "⅞" => "sept huitièmes" }.each do |original, converted| define_method "test_vulgar_fractions_conversion: #{original}" do assert_equal converted, original.convert_vulgar_fractions end end end