glebm / i18n-tasks

Manage translation and localization with static analysis, for Ruby i18n
http://glebm.github.io/i18n-tasks
MIT License
2.07k stars 262 forks source link

Using "default" as base_value #55

Closed SebastianHe closed 9 years ago

SebastianHe commented 10 years ago

Hello,

i want to use the "default" value as base_value.

Example: in my code:

<%= t '.invite_header', default: 'Leitstellenspiel weiterempfehlen' %>

The german file should look like: referrals: index: invite_header: Leitstellenspiel weiterempfehlen

How can i do this?

best regards, Sebastian

glebm commented 10 years ago

You would have to extend the parser to parse out the default. It's not easy, but can be done, similar to how scope argument is parsed: https://github.com/glebm/i18n-tasks/blob/master/lib/i18n/tasks/scanners/pattern_with_scope_scanner.rb

lime commented 9 years ago

In case someone wants to tackle this, I happened upon this gist that tries to do something similar: https://gist.github.com/zyphlar/5216623/

Maybe it can be useful as a starting point.

glebm commented 9 years ago

This is now available in v0.9.0.rc2 (only for .rb files), and will be available in the v0.9.0 release.