- Uses AST-parser for all ERB-files, not just
.html.erb
- [Fixed regex in
PatternScanner
] (#572) - Adds contextual parser to support more Rails-translations #565
- Newlines are now preserved when using Google Translate. #567
- Improved locale name handling for Google Translate. #558
- Fixes compatibility with some versions of the i18n gem. #553
- Added
i18n-tasks cp
command. #551 - Parentheses in keys are now supported. #550
- Non-HTML ERB files are now supported. #545
- Adds an optional isolating router that assumes each YAML file is independent. #541
- Adds an optional AST matcher for Rails default_i18n_subject. #538 #539
- Supports DeepL glossaries. #535
- Supports hashes for DeepL and other translators. #531
- Adds configuration for OpenAI prompt. #533
- Adds configuration for OpenAI model. #532 #534
- OpenAI translator. #519
- DeepL
- Support partially dynamic segments in non-strict mode (e.g.
t "cats.#{cat}-bio.name"
). #509 - Fixes
grep_keys
in Ruby 3+. #492 - Improved handling of older libyaml versions. #493
- The heuristic for detecting non-plural keys that look like plural keys has been removed
because it was causing other issues. Please use
ignore_missing
to handle such keys. #461 - Adds support for plural default values,
e.g.
t('test', default: { one: '1', other: '2' })
. #464 - Adds the
-p
pattern option to themissing
,add-missing
, andtranslate-missing
commands. #469 - Relaxes version restriction for the
better_html
depedency to allow v2.x. #471 - Support filenames where locale is separated by a
-
, e.g.user-en.yml
instead of the usualuser.en.yml
. #467
-
Fixes
--config
command line flag. #455 -
Fixes circular
require
warnings on Ruby 3.1.2. #457 -
*.xlsx
files are now excluded by default. #458
- Fixes
relative_exclude_method_name_paths
. Previously, the code usedexclude_method_name_paths
instead ofrelative_exclude_method_name_paths
. #454
-
Adds an optional AST matcher for Rails model translations, such as
human_attribute_name
.Can be enabled by adding the following to the config:
<% I18n::Tasks.add_ast_matcher('I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher') %>
- Fixes a crash in
strict: false
mode. #445
- Fixes an issue with
scope:
argument parsing. #442
- Fixes handling of more types of ERB comments. #437
- Fixes handling of multiline ERB comments. #431
- Fixes handling of ERB comments without a space between
%
and#
(<%# ... %>
). #429 - Better support for the
it
gem. #361
- Fixes inline block handling in ERB files. #427
- Fixes block call handling in ERB files. #425
- Fixes
better_html
scanning the project. #422
- Log #StandWithUkraine to stderr on every CLI command.
- Improved ERB parsing: Replaces a regexp-based parser with an AST parser. #416
- Fixes compatibility with Psych 4.0+ and Ruby 3.1. #415
- Works around an emoji handling bug in libyaml. #421
- Reverted
"#{hash["key"]}"
pattern scanner support because it caused a number of issues. #410 - Drops support for Ruby < 2.6. #2552cdb3
- Fixes ActiveSupport 7 compatibility. #403
- Fixes mixed optional and keyword arguments in
I18n::Tasks::BaseTask.new
. #401 *.map
files are now ignored by default. #399data
task now supports thekey-values
format that outputs a TSV. #398"#{hash["key"]}"
interpolations are now supported in the pattern scanner. #397 #405- Forward slash (
/
) is now an allowed character in translation keys. #396
- New CLI argument
--config
, to specify the config file location. #394 - Allow relative keys in any Ruby object. #381
- Fix not ignoring missing for pluralization. #389
- A more robust translation interpolation replacement token. #392
- Add
deepl_host
anddeepl_version
to translation config. #384 - Add
*.jpeg
to the default ignore list. #382
- Fixes DeepL translation. #367
- Support capitalized region names in locale codes (e.g. "zh-YUE") #357
- DeepL: Fix single value translation. #d31297b5
- Fix missing key detection for external keys in non-base locale. #364
required_ruby_version
: Allow Ruby 3.x.- Fix deprecation warnings on Ruby 2.7.1. #352
- Fix keyword arguments warnings in Ruby 2.7. #342
- Recognize
t!
andtranslate!
methods. #329 - Test template now tests for inconsistent interpolations. #317
- The
remove_unused
command now supports--pattern
. #327 - Common audio and video file extensions are now ignored. #324
- The test templates for RSpec and minitest now include consistent interpolations check. #317
- Leaf->tree expansion warnings are no longer issued for plural keys (where they are legal). #314
- Single line comments are now ignored in
.js
and.es6
files. Magic comments are still supported (e.g.// i18n-tasks-use I18n.t('hello')
). #322 - No longer loads all of
rails-i18n
and doesn't setI18n.enforce_available_locales
, fixing some compatibility issues introduced in v0.9.28. #315
- The
missing
command now also detects incomplete pluralizations. #308
- Fixes
check-consistent-interpolations
when the same interpolation is used more than once.
-
eq-base
command now returns a non-zero exit code if there are any results. #301 -
New command,
check-consistent-interpolations
, checks that %-interpolations across all locales are consistent. The corresponding ignore setting isignore_inconsistent_interpolations
.This check also runs as part of the
health
command.
- Adds an optional
--keep-order
(-k
) parameter toremove-unused
. When passed, keys in the files are not sorted after removing the unused keys. #297 - Drops support for Ruby < 2.3. #298
- Fixes a rare concurrency issue, most easily reproduced on Rubinius. #300
- Avoid Google / DeepL translating empty keys (a minor optimization). #fc529e78
- Makes
deepl-rb
andeasy_translate
dependencies optional. #296 - Adds DeepL support to
tree-translate
. - Removes the deprecated
tree-rename-key
command. - Removes obsolete XSLX report functionality.
Fixes DeepL locale handling. #49d6d2b6
Adds the DeepL Machine Translation service. #294
You can use it by passing --backend=deepl
to translate-missing
:
i18n-tasks translate-missing --backend deepl
Like Google Translate, DeepL also requires an API key. It can be set either via the DEEPL_AUTH_KEY
environment
variable, or by setting translation.deepl_api_key
in i18n-tasks.yml
.
Relaxes the rainbow
dependency version restriction.
i18n-tasks tree-mv
now defaults to matching key patterns including the locale, consistent with other tree-
commands.
Fixes #274.
Fixes missing
ignoring the -t
argument.
#271
Adds a new configuration setting, data.external
, for locale data from external dependencies (e.g. gems).
This locale data is never considered unused, and is never modified by i18n-tasks.
#264
Fixes support for calls such as t @instance_variable, scope: :static_scope
in the non-AST scanner.
#1d2c6d0c
Fixes remove-unused
not removing entire files.
#260
Fixes normalize
not removing emptied files.
#263
Fixes support for calls such as t dynamic_key, scope: :static_scope
in the non-AST scanner.
#255
Adds a new task, check-normalized
, and the corresponding specs, to verify that all the locale files are normalized.
#249
Fixes an issue with normalization not happening in certain cases. #91b593d7
There is now a minitest template file available. #250
Internally, Erubi is now used instead of Erubis for parsing the config file. #247
Improves handling of interpolations in translate-missing
when multiple interpolations are present.
Adds new configuration options to the built-in scanners to enable support for non-standard messages and receivers.
For example, to support the it
gem:
# lib/i18n_tasks_it.rb
# The "it" gem support for i18n-tasks
I18n::Tasks.add_scanner(
'::I18n::Tasks::Scanners::RubyAstScanner',
receiver_messages: [nil, AST::Node.new(:const, [nil, :It])].product(%i[it]),
only: %w[*.rb]
)
I18n::Tasks.add_scanner(
'::I18n::Tasks::Scanners::PatternWithScopeScanner',
translate_call: /(?<=^|[^\w'\-.]|[^\w'\-]It\.|It\.)it/,
exclude: %w[*.rb]
)
# config/i18n-tasks.yml.erb
<% require './lib/i18n_tasks_it' %>
-
AST scanner: support nested
t
calls in ruby files. #c61f4e00 -
Exclude
*.swf
and*.flv
files by default. #233
This release removes a GPL-licensed dependency, Term::ANSIColor
, with the MIT-licensed Rainbow gem.
Thanks, @ypresto, for discovering and fixing the issue!
This is a minor bugfix release.
- Do not warn about "adding children to leaf" for keys found in source. #228
- Fix an issue with nested keys with the
scope
argument in views. #224
This is a minor bugfix release.
- Fixes another issue with the
scope
argument in views. #224
This is a minor bugfix release.
- Fixes parenthesized
t()
calls with ascope
argument in views. #224 - Fixes the
i18n-tasks irb
task. #222
This release fixes an issue with dynamic scope arguments in views.
This affects calls like the following:
<%= t('key', scope: dynamic) %>
Previously, i18n-tasks would incorrectly parse it as key
. Now, such calls are ignored.
This release adds the mv
command for renaming/moving the keys.
#116
This is a minor bugfix release.
- Fixed
add-missing
command ignoring the locales argument. #205 - Always require
PatternMapper
so that it doesn't need requiring in the config. #204 - If
internal_locale
is set to a locale that's not available, reset it toen
and print a warning. #202
This is a minor bugfix release.
- Fixes the
ignore_lines
PatternScanner feature. #206 - Allows
:
to be a part of the key. #207 - Fixes translation of plural HTML keys. #193
- Add a
PatternMapper
scanner for mapping bits of code to keys #191. - Add missing keys with
nil
value by passing--nil-value
toadd-missing
. #170 - Requiring
i18n-tasks
no longer overridesI18n.locale
. #190.
- Improve reporting for reference keys throughout.
- Fix ActiveSupport >= 4.0 but < 4.2 compatibility. #178
- Locale file path rewriting now matches locales as directories and multiple instances of the locale in the path. #176 #177
- New method:
I18n::Tasks.add_scanner(scanner_class_name, scanner_opts)
to add a scanner to the default configuration. - New method:
I18n::Tasks.add_commands(commands_module)
to add commands toi18n-tasks
. - Only match
I18n
ornil
receivers in PatternScanner.
- Support for multiple scanners.
- AST scanner for
.rb
files. default:
argument support foradd-missing -v
. AST scanner only. #55- Recognize that only
t
calls can use relative keys, notI18n.t
. AST scanner only. #106 - Strict mode enabled by default, can be configured via
search.strict
. New argument:--no-strict
. search.include
renamed tosearch.only
.
- New interpolation value for
add-missing -v
:%{key}
. Stijn Mathysen #164 - When adding keys from non-default locales, merge base locale first, then the others. #162
- Report missing keys found in source in all the locales. #162
- Fix
data-remove
task. #140 - Non-zero exit code on
health
,missing
, andunused
if such keys are present. #151 - XLSX report compatibility with the OSX Numbers App. #159
- RSpec template compatibility with
config.expose_dsl_globally = false
. #148 bundle show vagrant
example in the config template is no longer interpolated .#161
- Fix regression: Plugin support #153.
- Support relative keys in mailers #155.
- Fix regression: ActiveSupport < 4 support #143.
- Fix failure on nil values in the data config #142.
- The default config file now excludes
app/assets/images
andapp/assets/fonts
. Add*.otf
to ignored extensions. - If an error message occurs when scanning, the error message now includes the filename #141.
- Parse command line arguments with
optparse
. Remove dependency on Slop. Simplified commands DSL: options are mostly passed directly to optparse. search.relative_roots
default changed from from%w(app/views)
to%w(app/views app/controllers app/helpers app/presenters)
.add-missing
now adds keys detected in source to all locales (previously just base) #134.- The default spec template no long requires
spec_helper
by default Daniel Levenson #135. search.exclude
now appends to and not overrides the default exclude list. More extensions excluded by default: *.css, *.sass, *.scss, *.less, *.yml, and *.json. #137.
- Fix relative keys when controller name consists of more than one word by Yuji Nakayama #132.
- Support keys with UTF8 word characters in the name. #133.
- Change missing report column title from "Details" to "Value in other locales or source", display the locale #130.
- Handle relative keys in controllers nested in modules by Alexander Tipugin. #128.
- Only write files that changed #125.
- Allow
[]
in the non-strict scanner pattern #127.
- Set slop dependency to 3.5 to ensure Ruby 1.9 compatibility (#121). MRI 1.9 EOL is February 23, 2015. We will support 1.9 until rbx and jruby support 2.0.
- Support relative keys in controller action with argument
- Support relative keys in Rails controller actions by Jessie A. Young. #46.
- Minor fixes
- Fix Google Translate issues with non-string keys #100
- Fix an issue with certain HAML not being parsed #96 #102
- Fix other minor issues
- Fix regression: keys are sorted once again #92.
- Add a post-install notice with setup commands
- Fix a small typo in the config template #91.
- Fix
find
crashing on relative keys (regression)
Dynamic key usage inference fixes by Mikko Koski:
- Append
:
to keys ending with dot '.' (to scant('category.' + cat)
ast('category.:')
) - Consider keys ending with
:
as match expressions - Make
@
a valid character for keys (to allowt("category.#{@cat}"
)
- Fix
add-missing --help
- Fix a minor issue with
health
#88
- New task
translate-tree
- Bugs fixed: nil values and Google Translate, config file encoding issue.
- i18n-tasks now analyses itself!
internal_locale
setting has been added, that controls i18n-tasks reporting language. English and Russian are available in this release.
- 1.9.3 compatibility
New tasks:
i18n-tasks health
to display missing and unused keys along with other informationi18n-tasks tree-
to manipulate treesi18n-tasks data-
to look up and manipulate locale data- Better
help
for all commands - Minor bug fixes
Internally:
- Refactored commands DSL
add-missing
,remove-unused
implemented in terms of the newtree-
commands
- Strict mode added for
unused
andremove-unused
. When passed-s
or--strict
, these tasks will not attempt to infer dynamic key usages, such ast("category.#{category.key}")
. - Arrays are now supported as values for Google Translate #77
- New task to show locale data:
i18n-tasks data
- New output format:
keys
, e.g.i18n-tasks data -fkeys
- Fix an issue with a top-level dynamic key breaking unused detection #75
- Document magic comment hints
- Fix Google Translate issue with plural keys and missing billing info error
- New output format options for reports: yaml, json, and inspect.
- Templates for config and rspec.
- Keys with values same as base locale have been moved from
missing
into a separate task,eq-base
. missing
now also shows keys that are present in some locale but not in base locale.- Terminal output: no more Type column in
missing
, first code usage shown for keys missing base value. relative_roots
configuration key moved tosearch.relative_roots
, deprecation warning (removed in the next minor).
- ActiveSupport 3 compatibility
- Fix Google translate regression
- More robust config output
- Ignore lines during search with
config.search.ignore_lines
. Ignores comments by default. - Fixed minor issues with
i18-tasks config
output.
- Fix conservative router.
- Conservative router is now the default.
- internals refactored to use trees everywhere
- type
guide
ini18n-tasks irb
to learn more about the commands - (remove-)unused tasks now work per locale
ignore
settings are shown oni18n-tasks config
- Rubinius 2.2.7 compatibility
- Respect tty color setting
- Fix google translate issues with plural keys and translating from non-base locale
- Ruby 1.9 compatibility
- Ruby 1.9.3-compatible again
- Improved error messages across the board
- Fixed google translate issue with _html keys #67.
- In addition to pattern router, a new conservative router that keeps the keys in place. (See #57)
i18n-tasks irb
for debugging- This release is a major refactoring to use real trees internally (as opposed to nested hashes). Real trees allow for much easier traversal. With these trees, information can be associated with each node, which allows for things like the conservative router.
- Accept keys with dashes (
-
) #64.
- Improve plural key handling
- New (de)serialization options in config
add-missing
placeholder argument can now use %{base_value}.
- Fix regression: Remove ActiveSupport::HashWithIndifferentAccess from locale data output
- Fix activesupport ~3.x compatibility issue (#45).
- Catch Errno::EPIPE to allow
i18n-tasks <command> | head
for large reports - Improved i18n-tasks config output
- fix issue with Google Translate
config.locales
is now picked up by default from paths do data files.base_locale
defaults toen
.
- Bugfixes
- Tasks that accept locales now accept them as the first argument(s)
- i18n-tasks is a binary now (instead of rake tasks). All tasks / commands now accept various options, and there is no need for as many of them as before.
- Works faster on Rails as it doesn't load anything but the gem, but now requires
base_locale
andlocales
to be set in config.
rake i18n:usages[pattern]
- performance regression fixes
rake i18n:usages
report
- Bugfixes
- Key search extracted into its own class, and a custom scanner can now be provided.
- Removed support for deprecated settings
- More robust I18n.t call detection (detect I18n.translate and multiline calls)
- Google Translate fixes: preserve interpolations, set correct format based on the key (text or html).
- New setting relative_roots for relative key resolution (default: %w(app/views))
- fix google translation attempts to translate non-string keys
- New task:
i18n:remove_unused
- config/i18n-tasks.yml now processed with ERB
- can now be used with any ruby apps, not just Rails
- more locale formats are considered valid
i18n:missing
accepts localesi18n:missing
supports plural keys
- more powerful key pattern matching with sets and backtracking
- spreadsheet report, tests run on rbx
- improved output with terminal-table
- fill tasks renamed, fix symbol key search
- 3 more prefill tasks, including Google Translate
- tasks renamed
- improved search: no longer uses grep, more robust detection (@natano)
- ability to route prefill output via data.write config
- multiple configuration variables renamed (still understands old syntax with deprecation warnings)
- New key pattern syntax for i18n-tasks.yml a la globbing
- Removed get_locale_data, added data configuration options
- Fix relative keys in partials (@paulfioravanti)
- Fix i18n:missing when nothing is missing (@tamtamchik)
- detect countable keys as used for unused task
- account for non-string keys coming from yaml (thanks @lichtamberg)
- added grep config options (thanks @dmke)
- improved terminal output