Module: ZendeskAppsSupport::Validations::Translations
- Defined in:
- lib/zendesk_apps_support/validations/translations.rb
Defined Under Namespace
Classes: TranslationFormatError
Constant Summary collapse
- TRANSLATIONS_PATH =
%r{^translations/(.*)\.json$}
- VALID_LOCALE =
/^[a-z]{2,3}(-\w{2,3})?$/
Class Method Summary collapse
Class Method Details
.call(package, opts = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/zendesk_apps_support/validations/translations.rb', line 15 def call(package, opts = {}) package.files.each_with_object([]) do |file, errors| path_match = TRANSLATIONS_PATH.match(file.relative_path) next unless path_match errors << locale_error(file, path_match[1]) << json_error(file) << format_error(file) next unless errors.compact.empty? if file.relative_path == 'translations/en.json' # rubocop:disable Metrics/LineLength errors.push(*validate_marketplace_content(file, package, opts.fetch(:skip_marketplace_translations, false))) end end.compact end |