Class: Rosette::Core::Validators::LocaleValidator
- Defined in:
- lib/rosette/core/validators/locale_validator.rb
Overview
Validates a locale by making sure the given repo has been configured to support it.
Instance Attribute Summary
Attributes inherited from Validator
Instance Method Summary collapse
-
#valid?(locale_code, repo_name, configuration) ⇒ Boolean
Returns true if the locale is valid, false otherwise.
Methods inherited from Validator
Constructor Details
This class inherits a constructor from Rosette::Core::Validators::Validator
Instance Method Details
#valid?(locale_code, repo_name, configuration) ⇒ Boolean
Returns true if the locale is valid, false otherwise.
24 25 26 27 28 29 30 31 32 |
# File 'lib/rosette/core/validators/locale_validator.rb', line 24 def valid?(locale_code, repo_name, configuration) repo = configuration.get_repo(repo_name) if locale_code && repo.get_locale(locale_code) true else << "Repo '#{repo_name}' doesn't support the '#{locale_code}' locale" false end end |