Skip to content

Commit f655aef

Browse files
Add Russian translation for errors (#631)
* Create money.ru.yml * fix invalid_currency error definition
1 parent 71b4d8f commit f655aef

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.14.1
4+
5+
- Fix invalid_currency error definition
6+
- Add Russian translation for errors
7+
38
## 1.14.0
49

510
- Tweaks to support Ruby 3.0

CONTRIBUTORS

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Jamie Dyer
3232
Joe Frambach
3333
John Wood
3434
Kevin Sołtysiak
35+
Kirill Shamardin
3536
Michael J.
3637
Mike Boone
3738
Nick

config/locales/money.en.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
en:
22
errors:
33
messages:
4-
invalid_currency: must be a valid currency (eg. '100', '5%{decimal}24', or '123%{thousands}456%{decimal}78'). Got %{currency}
5-
4+
invalid_currency: has invalid format (must be '100', '5%{decimal}24', or '123%{thousands}456%{decimal}78'). Got %{currency}

config/locales/money.ru.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ru:
2+
errors:
3+
messages:
4+
invalid_currency: имеет неверный формат (должно быть '100', '5%{decimal}24', или '123%{thousands}456%{decimal}78'). Получено %{currency}

spec/active_record/monetizable_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,15 @@ class SubProduct < Product
245245
product.price = "12,23.24"
246246
expect(product.save).to be_falsey
247247
expect(product.errors[:price].size).to eq(1)
248-
expect(product.errors[:price].first).to match(/must be a valid/)
248+
expect(product.errors[:price].first).to match(/has invalid format/)
249249
expect(product.errors[:price].first).to match(/Got 12,23.24/)
250250
end
251251

252252
it "fails validation with the proper error message if money value has thousand char after decimal mark" do
253253
product.price = "1.234,56"
254254
expect(product.save).to be_falsey
255255
expect(product.errors[:price].size).to eq(1)
256-
expect(product.errors[:price].first).to match(/must be a valid/)
256+
expect(product.errors[:price].first).to match(/has invalid format/)
257257
expect(product.errors[:price].first).to match(/Got 1.234,56/)
258258
end
259259

0 commit comments

Comments
 (0)