Skip to content

Commit 489f07d

Browse files
authored
Merge pull request #1100 from masoo/delete_broken_jpy_function
Remove special handling for Japanese language only
2 parents 20fba2a + f628edd commit 489f07d

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- **Potential breaking change**: Fix RSD (Serbian Dinar) formatting to be like `12.345,42 RSD`
77
- **Potential breaking change**: Fix USDC decimals places from 2 to 6
88
- **Potential breaking change**: Fix MGA (Malagasy Ariary) to be a zero-decimal currency (changing subunit_to_unit from 5 to 1)
9+
- **Potential breaking change**: Remove special handling for Japanese language only
910
- Updated Armenian Dram sign and HTML entity
1011
- Updated the Turkmen Manat symbol and HTML entity and added disambiguation symbol for TMM
1112
- Expose Money::VERSION

lib/money/money/formatting_rules.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ def initialize(currency, *raw_rules)
99
@rules = normalize_formatting_rules(raw_rules)
1010

1111
@rules = default_formatting_rules.merge(@rules) unless @rules[:ignore_defaults]
12-
@rules = localize_formatting_rules(@rules)
1312
@rules = translate_formatting_rules(@rules) if @rules[:translate]
1413
@rules[:format] ||= determine_format_from_formatting_rules(@rules)
1514
@rules[:delimiter_pattern] ||= delimiter_pattern_rule(@rules)
@@ -71,14 +70,6 @@ def translate_formatting_rules(rules)
7170
rules
7271
end
7372

74-
def localize_formatting_rules(rules)
75-
if currency.iso_code == "JPY" && I18n.locale == :ja && rules[:format] == nil
76-
rules[:symbol] = "円" unless rules[:symbol] == false
77-
rules[:format] = '%n%u'
78-
end
79-
rules
80-
end
81-
8273
def determine_format_from_formatting_rules(rules)
8374
return currency.format if currency.format && !rules.has_key?(:symbol_position)
8475

spec/money/formatting_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@
145145

146146
it "formats Japanese currency in Japanese properly" do
147147
money = Money.new(1000, "JPY")
148-
expect(money.format).to eq "1,000円"
148+
expect(money.format).to eq "¥1,000"
149+
expect(money.format(format: "%n%u", symbol: "円")).to eq "1,000円"
149150
expect(money.format(symbol: false)).to eq "1,000"
150151
expect(money.format(format: "%u%n")).to eq "¥1,000"
151152
end

0 commit comments

Comments
 (0)