Skip to content

Commit

Permalink
Merge pull request RubyMoney#1067 from masoo/jpy_formatting
Browse files Browse the repository at this point in the history
Fix the issue where japanese formatting is no longer possible.
  • Loading branch information
semmons99 committed Mar 13, 2024
2 parents 79989af + 656aab2 commit 2ef600a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/money/money/formatting_rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def translate_formatting_rules(rules)
end

def localize_formatting_rules(rules)
if currency.iso_code == "JPY" && I18n.locale == :ja
if currency.iso_code == "JPY" && I18n.locale == :ja && rules[:format] == nil
rules[:symbol] = "円" unless rules[:symbol] == false
rules[:format] = '%n%u'
end
Expand Down
1 change: 1 addition & 0 deletions spec/money/formatting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
money = Money.new(1000, "JPY")
expect(money.format).to eq "1,000円"
expect(money.format(symbol: false)).to eq "1,000"
expect(money.format(format: "%u%n")).to eq "¥1,000"
end

after { I18n.locale = @_locale }
Expand Down

0 comments on commit 2ef600a

Please sign in to comment.