]> git.openstreetmap.org Git - rails.git/blob - config/i18n-tasks.yml
Add the i18n-tasks gem
[rails.git] / config / i18n-tasks.yml
1 # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
2
3 # The "main" locale.
4 base_locale: en
5 ## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
6 # locales: [es, fr]
7 ## Reporting locale, default: en. Available: en, ru.
8 # internal_locale: en
9
10 # Read and write translations.
11 data:
12   ## Translations are read from the file system. Supported format: YAML, JSON.
13   ## Provide a custom adapter:
14   # adapter: I18n::Tasks::Data::FileSystem
15
16   # Locale files or `File.find` patterns where translations are read from:
17   read:
18     ## Default:
19     - config/locales/en.yml
20     ## More files:
21     # - config/locales/**/*.%{locale}.yml
22
23   # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
24   # `i18n-tasks normalize -p` will force move the keys according to these rules
25   write:
26     ## For example, write devise and simple form keys to their respective files:
27     # - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
28     ## Catch-all default:
29     # - config/locales/%{locale}.yml
30
31   # External locale data (e.g. gems).
32   # This data is not considered unused and is never written to.
33   external:
34     ## Example (replace %#= with %=):
35     # - "<%#= %x[bundle info vagrant --path].chomp %>/templates/locales/%{locale}.yml"
36
37   ## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class.
38   # router: conservative_router
39
40   yaml:
41     write:
42       # do not wrap lines at 80 characters
43       line_width: -1
44
45   ## Pretty-print JSON:
46   # json:
47   #   write:
48   #     indent: '  '
49   #     space: ' '
50   #     object_nl: "\n"
51   #     array_nl: "\n"
52
53 # Find translate calls
54 search:
55   ## Paths or `File.find` patterns to search in:
56   # paths:
57   #  - app/
58
59   ## Root directories for relative keys resolution.
60   # relative_roots:
61   #   - app/controllers
62   #   - app/helpers
63   #   - app/mailers
64   #   - app/presenters
65   #   - app/views
66
67   ## Directories where method names which should not be part of a relative key resolution.
68   # By default, if a relative translation is used inside a method, the name of the method will be considered part of the resolved key.
69   # Directories listed here will not consider the name of the method part of the resolved key
70   #
71   # relative_exclude_method_name_paths:
72   #  -
73
74   ## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
75   ##   *.jpg *.jpeg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less
76   ##   *.yml *.json *.zip *.tar.gz *.swf *.flv *.mp3 *.wav *.flac *.webm *.mp4 *.ogg *.opus *.webp *.map *.xlsx
77   exclude:
78     - app/assets/images
79     - app/assets/fonts
80     - app/assets/videos
81     - app/assets/builds
82
83   ## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
84   ## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
85   # only: ["*.rb", "*.html.slim"]
86
87   ## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
88   strict: false
89
90   ## Allows adding ast_matchers for finding translations using the AST-scanners
91   ## The available matchers are:
92   ## - RailsModelMatcher
93   ##     Matches ActiveRecord translations like
94   ##     User.human_attribute_name(:email) and User.model_name.human
95   ##
96   ## To implement your own, please see `I18n::Tasks::Scanners::AstMatchers::BaseMatcher`.
97   <%# I18n::Tasks.add_ast_matcher('I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher') %>
98
99   ## Multiple scanners can be used. Their results are merged.
100   ## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
101   ## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
102
103 ## Translation Services
104 # translation:
105 #   # Google Translate
106 #   # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
107 #   google_translate_api_key: "AbC-dEf5"
108 #   # DeepL Pro Translate
109 #   # Get an API key and subscription at https://www.deepl.com/pro to use DeepL Pro
110 #   deepl_api_key: "48E92789-57A3-466A-9959-1A1A1A1A1A1A"
111 #   # deepl_host: "https://api.deepl.com"
112 #   # deepl_version: "v2"
113
114 ## Do not consider these keys missing:
115 # ignore_missing:
116 # - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
117 # - '{devise,simple_form}.*'
118
119 ## Consider these keys used:
120 ignore_unused:
121   - 'geocoder.search_osm_nominatim.prefix.*'
122   - 'javascripts.*'
123   - 'activerecord.attributes.*'
124   - 'activerecord.models.*'
125   - 'activerecord.help.*'
126   - 'helpers.submit.*'
127   - 'datetime.distance_in_words_ago.*'
128   - 'reports.new.categories.*' # double interpolation in reports_helper
129 # - '{devise,kaminari,will_paginate}.*'
130 # - 'simple_form.{yes,no}'
131 # - 'simple_form.{placeholders,hints,labels}.*'
132 # - 'simple_form.{error_notification,required}.:'
133
134 ## Exclude these keys from the `i18n-tasks eq-base' report:
135 # ignore_eq_base:
136 #   all:
137 #     - common.ok
138 #   fr,es:
139 #     - common.brand
140
141 ## Exclude these keys from the `i18n-tasks check-consistent-interpolations` report:
142 # ignore_inconsistent_interpolations:
143 # - 'activerecord.attributes.*'
144
145 ## Ignore these keys completely:
146 # ignore:
147 #  - kaminari.*
148
149 ## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
150 ## e.g. in case of a relative key defined in a helper method.
151 ## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
152 #
153 # <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
154 #       only: %w(*.html.haml *.html.slim),
155 #       patterns: [['= title\b', '.page_title']] %>
156 #
157 # The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
158 #
159 # <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
160 #       patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>