-
Notifications
You must be signed in to change notification settings - Fork 264
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
Guidance on custom key matching #110
Comments
Hi, as i18n-tasks doesn't support multiple scanners yet (#81 - help is welcome!), you could inherit from class MyScanner < I18n::Tasks::Scanners::PatternScanner
def scan_file(path, opts = {})
keys = ... # custom parsing
super + keys
end
end The method must return an array with elements like below: ['full.key', data: {
src_path: 'path/to/file.rb',
pos: 51,
line_num: 2,
line_pos: 1,
line: 'serialize_error(%i(full key))'
}] Then, specify the scanner in <% require_relative '../lib/my_scanner.rb' %>
...
search:
scanner: MyScanner |
OK thanks, I'll give this a go soon and see how that goes |
Great! Feel free to ask stuff on our Gitter chat room. |
This will be a lot easier with v0.9. Please see the example here: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example. |
I'm mainly looking for guidance, but you could argue that this is an issue in itself (I can't work out how to do this from the docs).
I dynamically build keys for I18n strings in my app in the following form...
This then resolves to two keys...
Where would I even begin to start making this work so I can check on unused keys etc? I'm guessing a custom scanner...??
Thanks
The text was updated successfully, but these errors were encountered: