Skip to content

Commit

Permalink
Add Dutch translation for invalid number
Browse files Browse the repository at this point in the history
  • Loading branch information
bdewater committed Jan 14, 2016
1 parent 833bb38 commit 8eedb96
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -105,7 +105,7 @@ validates_plausible_phone :phone_number, without: /^\+\d+/
validates_plausible_phone :phone_number, presence: true, with: /^\+\d+/
```

the i18n key is `:improbable_phone`. Languages supported by default: de, en, fr, it, ja, kh, tr, ua and ru.
the i18n key is `:improbable_phone`. Languages supported by default: de, en, fr, it, ja, kh, nl, tr, ua and ru.

You can also validate if a number has the correct country number:

Expand Down
4 changes: 4 additions & 0 deletions lib/phony_rails/locales/nl.yml
@@ -0,0 +1,4 @@
nl:
errors:
messages:
improbable_phone: "is geen geldig nummer"
8 changes: 8 additions & 0 deletions spec/lib/validators/phony_validator_spec.rb
Expand Up @@ -157,6 +157,14 @@ class MismatchedHelpfulHome < ActiveRecord::Base
expect(@home.errors.messages).to include(phone_number: ["is an invalid number"])
end

it "should translate the error message in Dutch" do
I18n.with_locale(:nl) do
@home.phone_number = INVALID_NUMBER
@home.valid?
expect(@home.errors.messages).to include(phone_number: ["is geen geldig nummer"])
end
end

it "should translate the error message in English" do
I18n.with_locale(:en) do
@home.phone_number = INVALID_NUMBER
Expand Down

0 comments on commit 8eedb96

Please sign in to comment.