Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Korean translation(including spec) #186

Merged
merged 2 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ validates_plausible_phone :phone_number, without: /\A\+\d+/
validates_plausible_phone :phone_number, presence: true, with: /\A\+\d+/
```

the i18n key is `:improbable_phone`. Languages supported by default: de, en, es, fr, it, ja, kh, nl, tr, ua and ru.
the i18n key is `:improbable_phone`. Languages supported by default: de, en, es, fr, it, ja, kh, ko, 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/ko.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ko:
errors:
messages:
improbable_phone: "는 올바른 전화번호가 아닙니다"
8 changes: 8 additions & 0 deletions spec/lib/validators/phony_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ def email
end
end

it 'should translate the error message in Korean' do
I18n.with_locale(:ko) do
@home.phone_number = INVALID_NUMBER
@home.valid?
expect(@home.errors.messages).to include(phone_number: ['는 올바른 전화번호가 아닙니다'])
end
end

it 'should translate the error message in Ukrainian' do
I18n.with_locale(:uk) do
@home.phone_number = INVALID_NUMBER
Expand Down