]> source.dussan.org Git - redmine.git/commitdiff
Merged r10476 from trunk (#11922)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 26 Sep 2012 11:09:24 +0000 (11:09 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 26 Sep 2012 11:09:24 +0000 (11:09 +0000)
fix number_to_currency() raises exception on Rails3 bs and de locale.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.1-stable@10479 e93f8b46-1217-0410-a6f0-8f06a7374b81

config/locales/bs.yml
config/locales/de.yml
test/unit/lib/redmine/i18n_test.rb

index 9f9590ea1c66b0d37df44446e99f0cdbf854ffd2..51cbd6040bb3e10590d2cca832c1dd2465b4c72a 100644 (file)
@@ -80,9 +80,8 @@ bs:
       format:
         unit: 'KM'
         format: '%u %n'
-        separator:
-        delimiter:
-        precision:
+        negative_format: '%u -%n'
+        delimiter: ''
     percentage:
       format:
         delimiter: ""
index be60c3a2b53ae638a63251cd82b24abe1e220f4f..24ad191ae7ae1c8aaffbe23a6eddbc69c0129d10 100644 (file)
@@ -84,9 +84,7 @@ de:
       format:
         unit: '€'
         format: '%n %u'
-        separator:
-        delimiter:
-        precision:
+        delimiter: ''
     percentage:
       format:
         delimiter: ""
index d234ddf3c6369bf90f606929157bf3b22d5eeed4..046ae23364b16c5a71de62758d19aff90e12fc3c 100644 (file)
@@ -171,6 +171,24 @@ class Redmine::I18nTest < ActiveSupport::TestCase
     assert_equal 'j', day_letter(4)
   end
 
+  def test_number_to_currency_for_each_language
+    valid_languages.each do |lang|
+      set_language_if_valid lang
+      assert_nothing_raised "#{lang} failure" do
+        number_to_currency(-1000.2)
+      end
+    end
+  end
+
+  def test_number_to_currency_default
+    set_language_if_valid 'bs'
+    assert_equal "KM -1000,20", number_to_currency(-1000.2)
+    set_language_if_valid 'de'
+    euro_sign = "\xe2\x82\xac"
+    euro_sign.force_encoding('UTF-8') if euro_sign.respond_to?(:force_encoding)
+    assert_equal "-1000,20 #{euro_sign}", number_to_currency(-1000.2)
+  end
+
   def test_valid_languages
     assert valid_languages.is_a?(Array)
     assert valid_languages.first.is_a?(Symbol)