From ed10a9dd621b971239d8c4e744f6841b0ea55f7d Mon Sep 17 00:00:00 2001 From: Judith Date: Fri, 4 Sep 2020 10:45:50 +0200 Subject: [PATCH] gem i18n-tasks added to Gemfile --- Gemfile | 1 + Gemfile.lock | 14 +++++ README.md | 1 + config/i18n-tasks.yml | 130 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+) create mode 100644 config/i18n-tasks.yml diff --git a/Gemfile b/Gemfile index ea8b1a9b7..265a66efc 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,7 @@ gem 'groupdate' gem 'haml-rails' gem 'hashie' gem 'http_accept_language' +gem 'i18n-tasks' gem 'iban-tools' gem 'image_processing' gem 'json_schemer' diff --git a/Gemfile.lock b/Gemfile.lock index b5d667839..3d8d3d540 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -340,6 +340,7 @@ GEM hana (1.3.7) hashdiff (1.0.1) hashie (4.1.0) + highline (2.0.3) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) @@ -354,6 +355,16 @@ GEM httpclient (2.8.3) i18n (1.8.7) concurrent-ruby (~> 1.0) + i18n-tasks (0.9.33) + activesupport (>= 4.0.2) + ast (>= 2.1.0) + erubi + highline (>= 2.0.0) + i18n + parser (>= 2.2.3.0) + rails-i18n + rainbow (>= 2.2.2, < 4.0) + terminal-table (>= 1.5.1) iban-tools (1.1.0) ice_nine (0.11.2) image_processing (1.12.1) @@ -722,6 +733,8 @@ GEM httpclient (>= 2.4) sysexits (1.2.0) temple (0.8.2) + terminal-table (3.0.0) + unicode-display_width (~> 1.1, >= 1.1.1) thor (1.1.0) thread_safe (0.3.6) tilt (2.0.10) @@ -843,6 +856,7 @@ DEPENDENCIES haml-rails hashie http_accept_language + i18n-tasks iban-tools image_processing json_schemer diff --git a/README.md b/README.md index 6cb3c6a00..f65a89276 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ Pour exécuter les tests de l'application, plusieurs possibilités : Le projet utilise plusieurs linters pour vérifier la lisibilité et la qualité du code. - Faire tourner tous les linters : `bin/rake lint` +- Vérifier l'état des traductions : `bundle exec i18n-tasks health` - [AccessLint](http://accesslint.com/) tourne automatiquement sur les PRs ### Régénérer les binstubs diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml new file mode 100644 index 000000000..5dbff94b3 --- /dev/null +++ b/config/i18n-tasks.yml @@ -0,0 +1,130 @@ +# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks + +# The "main" locale. +base_locale: fr +## All available locales are inferred from the data by default. Alternatively, specify them explicitly: +# locales: [es, fr] +## Reporting locale, default: en. Available: en, ru. +# internal_locale: en + +# Read and write translations. +data: + ## Translations are read from the file system. Supported format: YAML, JSON. + ## Provide a custom adapter: + # adapter: I18n::Tasks::Data::FileSystem + + # Locale files or `File.find` patterns where translations are read from: + read: + - config/locales/*%{locale}.yml + - config/locales/**/*%{locale}.yml + + # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom: + # `i18n-tasks normalize -p` will force move the keys according to these rules + write: + ## For example, write devise and simple form keys to their respective files: + # - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml'] + ## Catch-all default: + # - config/locales/%{locale}.yml + + # External locale data (e.g. gems). + # This data is not considered unused and is never written to. + external: + ## Example (replace %#= with %=): + # - "<%#= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml" + + ## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class. + # router: conservative_router + + yaml: + write: + # do not wrap lines at 80 characters + line_width: -1 + + ## Pretty-print JSON: + # json: + # write: + # indent: ' ' + # space: ' ' + # object_nl: "\n" + # array_nl: "\n" + +# Find translate calls +search: + ## Paths or `File.find` patterns to search in: + # paths: + # - app/ + + ## Root directories for relative keys resolution. + # relative_roots: + # - app/controllers + # - app/helpers + # - app/mailers + # - app/presenters + # - app/views + + ## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting: + ## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json) + exclude: + - app/assets/images + - app/assets/fonts + - app/assets/videos + + ## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`: + ## If specified, this settings takes priority over `exclude`, but `exclude` still applies. + # only: ["*.rb", "*.html.slim"] + + ## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`. + # strict: true + + ## Multiple scanners can be used. Their results are merged. + ## The options specified above are passed down to each scanner. Per-scanner options can be specified as well. + ## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example + +## Translation Services +# translation: +# # Google Translate +# # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate +# google_translate_api_key: "AbC-dEf5" +# # DeepL Pro Translate +# # Get an API key and subscription at https://www.deepl.com/pro to use DeepL Pro +# 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}.*' + +## Consider these keys used: +ignore_unused: +# - '{devise,kaminari,will_paginate}.*' +# - 'simple_form.{yes,no}' +# - 'simple_form.{placeholders,hints,labels}.*' +# - 'simple_form.{error_notification,required}.:' + +## Exclude these keys from the `i18n-tasks eq-base' report: +# ignore_eq_base: +# all: +# - common.ok +# fr,es: +# - common.brand + +## Exclude these keys from the `i18n-tasks check-consistent-interpolations` report: +# ignore_inconsistent_interpolations: +# - 'activerecord.attributes.*' + +## Ignore these keys completely: +# ignore: +# - kaminari.* + +## Sometimes, it isn't possible for i18n-tasks to match the key correctly, +## e.g. in case of a relative key defined in a helper method. +## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.: +# +# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper', +# only: %w(*.html.haml *.html.slim), +# patterns: [['= title\b', '.page_title']] %> +# +# The PatternMapper can also match key literals via a special %{key} interpolation, e.g.: +# +# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper', +# patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>