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

Normalize and fixes missing locales #1312

Merged
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ end
group :development, :test do
gem "awesome_print"
gem "faker", require: false
gem "i18n-tasks", "~> 1.0.12"
end

group :test do
Expand Down
28 changes: 28 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ GEM
aws-sigv4 (1.5.1)
aws-eventstream (~> 1, >= 1.0.2)
bcrypt (3.1.18)
better_html (2.0.1)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bindex (0.8.1)
bootsnap (1.13.0)
msgpack (~> 1.2)
Expand Down Expand Up @@ -189,6 +196,7 @@ GEM
groupdate (6.1.0)
activesupport (>= 5.2)
hashdiff (1.0.1)
highline (2.0.3)
hightop (0.3.0)
activesupport (>= 5.2)
hotwire-livereload (1.2.2)
Expand All @@ -200,6 +208,17 @@ GEM
multi_xml (>= 0.5.2)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.12)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
better_html (>= 1.0, < 3.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)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
Expand Down Expand Up @@ -249,6 +268,8 @@ GEM
nokogiri (1.13.8)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.8-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
pagy (5.10.1)
activesupport
Expand Down Expand Up @@ -289,6 +310,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
rails-i18n (7.0.5)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (6.1.6.1)
actionpack (= 6.1.6.1)
activesupport (= 6.1.6.1)
Expand Down Expand Up @@ -365,6 +389,7 @@ GEM
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sixarm_ruby_unaccent (1.2.0)
smart_properties (1.17.0)
spring (4.0.0)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
Expand All @@ -378,6 +403,8 @@ GEM
standard (1.16.0)
rubocop (= 1.35.0)
rubocop-performance (= 1.14.3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
test-prof (1.0.10)
thor (1.2.1)
timeout (0.3.0)
Expand Down Expand Up @@ -452,6 +479,7 @@ DEPENDENCIES
hotwire-livereload (~> 1.1)
htmlbeautifier
httparty
i18n-tasks (~> 1.0.12)
image_processing (~> 1.12)
iso
jsbundling-rails
Expand Down
159 changes: 159 additions & 0 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks

# The "main" locale.
base_locale: en
## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
locales: [en, fr, nb, nn, pt-BR, ro, tr]
## 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:
## Default:
# - config/locales/%{locale}.yml
## More files:
- lib/generators/avo/templates/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 info vagrant --path].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

## Directories where method names which should not be part of a relative key resolution.
# By default, if a relative translation is used inside a method, the name of the method will be considered part of the resolved key.
# Directories listed here will not consider the name of the method part of the resolved key
#
# relative_exclude_method_name_paths:
# -

## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
## *.jpg *.jpeg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less
## *.yml *.json *.zip *.tar.gz *.swf *.flv *.mp3 *.wav *.flac *.webm *.mp4 *.ogg *.opus *.webp *.map *.xlsx
exclude:
- app/assets/images
- app/assets/fonts
- app/assets/videos
- app/assets/builds

## 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

## Allows adding ast_matchers for finding translations using the AST-scanners
## The available matchers are:
## - RailsModelMatcher
## Matches ActiveRecord translations like
## User.human_attribute_name(:email) and User.model_name.human
##
## To implement your own, please see `I18n::Tasks::Scanners::AstMatchers::BaseMatcher`.
<%# I18n::Tasks.add_ast_matcher('I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher') %>

## 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"
# # deepl_host: "https://api.deepl.com"
# # deepl_version: "v2"

## Do not consider these keys missing:
ignore_missing:
- 'avo.field_translations.file'
- 'avo.field_translations.people'
- 'avo.number_of_items'
- 'avo.resource_translations.user'
- 'avo.x_items_more'

# - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
# - '{devise,simple_form}.*'

## Consider these keys used:
# ignore_unused:
# - 'activerecord.attributes.*'
# - '{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}']] %>
1 change: 1 addition & 0 deletions gemfiles/rails_6.0_ruby_3.0.3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ end
group :development, :test do
gem "awesome_print"
gem "faker", require: false
gem "i18n-tasks", "~> 1.0.12"
end

group :test do
Expand Down
28 changes: 27 additions & 1 deletion gemfiles/rails_6.0_ruby_3.0.3.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ GEM
aws-sigv4 (1.5.1)
aws-eventstream (~> 1, >= 1.0.2)
bcrypt (3.1.18)
better_html (2.0.1)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bindex (0.8.1)
bootsnap (1.12.0)
msgpack (~> 1.2)
Expand Down Expand Up @@ -185,6 +192,7 @@ GEM
groupdate (6.1.0)
activesupport (>= 5.2)
hashdiff (1.0.1)
highline (2.0.3)
hightop (0.3.0)
activesupport (>= 5.2)
hotwire-livereload (1.2.0)
Expand All @@ -196,6 +204,17 @@ GEM
multi_xml (>= 0.5.2)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.12)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
better_html (>= 1.0, < 3.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)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
Expand Down Expand Up @@ -283,6 +302,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
rails-i18n (7.0.5)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (6.0.5.1)
actionpack (= 6.0.5.1)
activesupport (= 6.0.5.1)
Expand Down Expand Up @@ -359,6 +381,7 @@ GEM
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sixarm_ruby_unaccent (1.2.0)
smart_properties (1.17.0)
spring (4.0.0)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
Expand All @@ -372,6 +395,8 @@ GEM
standard (1.13.0)
rubocop (= 1.31.2)
rubocop-performance (= 1.14.3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
test-prof (1.0.9)
thor (1.2.1)
thread_safe (0.3.6)
Expand Down Expand Up @@ -446,6 +471,7 @@ DEPENDENCIES
hotwire-livereload (~> 1.1)
htmlbeautifier
httparty
i18n-tasks (~> 1.0.12)
image_processing (~> 1.12)
iso
jsbundling-rails
Expand Down Expand Up @@ -479,4 +505,4 @@ DEPENDENCIES
zeitwerk (~> 2.3)

BUNDLED WITH
2.3.5
2.3.23
1 change: 1 addition & 0 deletions gemfiles/rails_6.0_ruby_3.1.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ end
group :development, :test do
gem "awesome_print"
gem "faker", require: false
gem "i18n-tasks", "~> 1.0.12"
end

group :test do
Expand Down
Loading