From 788c7267c6af693602d1cb8df1d9c8ed380b9e1a Mon Sep 17 00:00:00 2001 From: echarp Date: Thu, 2 May 2019 12:34:03 +0200 Subject: [PATCH] Better i18n-tasks config --- config/i18n-tasks.yml | 8 ++++---- config/locales/models/pt-BR.yml | 3 +++ test/i18n_test.rb | 13 ++++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 66e8de39..5119f42f 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -3,7 +3,7 @@ # The "main" locale. base_locale: en ## All available locales are inferred from the data by default. Alternatively, specify them explicitly: -# locales: [es, fr] +locales: [en, fr, pt-BR] ## Reporting locale, default: en. Available: en, ru. # internal_locale: en @@ -94,9 +94,9 @@ search: # deepl_api_key: "48E92789-57A3-466A-9959-1A1A1A1A1A1A" ## Do not consider these keys missing: -# ignore_missing: -# - 'errors.messages.{accepted,blank,invalid,too_short,too_long}' -# - '{devise,simple_form}.*' +ignore_missing: +- 'errors.messages.{accepted,blank,invalid,too_short,too_long}' +- '{devise,ice_cube,simple_form}.*' ## Consider these keys used: ignore_unused: diff --git a/config/locales/models/pt-BR.yml b/config/locales/models/pt-BR.yml index 1b211db8..ff6f5213 100644 --- a/config/locales/models/pt-BR.yml +++ b/config/locales/models/pt-BR.yml @@ -85,6 +85,9 @@ pt-BR: tags: Tags reason: Justificativa region: + region: Estado + url: Site + code: Code name_values: all: Todos os estados note: diff --git a/test/i18n_test.rb b/test/i18n_test.rb index a521dabf..b1dd4178 100644 --- a/test/i18n_test.rb +++ b/test/i18n_test.rb @@ -11,26 +11,29 @@ class I18nTest < ActiveSupport::TestCase def test_no_missing_keys assert_empty @missing_keys, - "Missing #{@missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them" + "Missing #{@missing_keys.leaves.count} i18n keys, + run `i18n-tasks missing' to show them" end def test_no_unused_keys assert_empty @unused_keys, - "#{@unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them" + "#{@unused_keys.leaves.count} unused i18n keys, + run `i18n-tasks unused' to show them" end def test_files_are_normalized non_normalized = @i18n.non_normalized_paths error_message = "The following files need to be normalized:\n" \ - "#{non_normalized.map { |path| " #{path}" }.join("\n")}\n" \ + "#{non_normalized.map { |path| " #{path}" }.join("\n")}\n" \ "Please run `i18n-tasks normalize' to fix" assert_empty non_normalized, error_message end def test_no_inconsistent_interpolations inconsistent_interpolations = @i18n.inconsistent_interpolations - error_message = "#{inconsistent_interpolations.leaves.count} i18n keys have inconsistent interpolations.\n" \ - "Please run `i18n-tasks check-consistent-interpolations' to show them" + error_message = "#{inconsistent_interpolations.leaves.count} i18n keys + have inconsistent interpolations.\n" \ + "Please run `i18n-tasks check-consistent-interpolations' to show them" assert_empty inconsistent_interpolations, error_message end end