Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 01 19:05
    glebm closed #398
  • Dec 01 19:05

    glebm on main

    Add key-values format to data t… (compare)

  • Dec 01 09:11
    arjan0307 review_requested #398
  • Dec 01 09:10
    arjan0307 synchronize #398
  • Nov 30 15:45
    djfpaagman opened #399
  • Nov 26 11:06
    arjan0307 opened #398
  • Nov 23 19:04
    ryanb commented #393
  • Nov 23 19:04
    ryanb commented #393
  • Nov 23 19:04
    ryanb commented #393
  • Nov 23 19:03
    ryanb commented #393
  • Nov 23 19:03
    ryanb commented #393
  • Nov 20 10:59
    glebm commented #397
  • Nov 20 10:59

    glebm on main

    Add specs for Ruby literal key … Allow "#{hash["key"]}" literal Treat hash literal as valid keys (compare)

  • Nov 20 10:59
    glebm closed #397
  • Nov 20 10:59
    glebm closed #354
  • Nov 20 07:29
    otoyo opened #397
  • Nov 18 22:59
    glebm commented #388
  • Nov 18 22:59
    glebm commented #388
  • Nov 18 16:13
    simonfranzen commented #388
  • Nov 18 16:12
    simonfranzen commented #388
Alexey Shein
@conf
Oh, nevermind. I've read documentation again and found solution:
# read from a gem (config is parsed with ERB first, then YAML)
- "<%= %x[bundle show russian].chomp %>/lib/russian/locale/*.yml"
Julien Vanier
@monkbroc
Hi
Can you point me in the right direction to make the key matcher regexp more permissive? I have keys like t("home.index.100+_categories") that are marked as unused because of the +. I'm not sure which config to change or const to monkeypatch to allow +, $ and % in the translation keys.
Didn't know this was allowed in yaml :)
Julien Vanier
@monkbroc

Thanks. Here's how I monkeypatched it.

In i18n-task.yml

<% require('./config/initializers/i18n-tasks.rb') %>

base_locale: en
#...

In config/initializers/i18n-tasks.rb

if defined? I18n::Tasks::Scanners::BaseScanner
  # Monkeypatch the list of string symbols with a more permissive
  # version to make the i15r and i18n-tasks gems compatible
  I18n::Tasks::Scanners::BaseScanner.send(:remove_const, :VALID_KEY_RE)
  I18n::Tasks::Scanners::BaseScanner.const_set(:VALID_KEY_RE, /^([-\w.?!;:+$%@]|[\#{@}])+$/)
end
By the way, the reason I have those keys is that I'm using the i15r gem to automatically extract strings from my views. It generates symbols with +, $ and %.
John Nico Garcia
@Winter41
Love this gem!
Jack Chan
@jchanfnet
I used the i18n-tasks normalize command, and it split my long strings into multiple lines. Is there any way to disable that?
Jack Chan
@jchanfnet
found it. just gotta change the config to line_width: -1 under yaml write
Colin Browne
@ceres629
I'm currently using i18n gettext helpers instead of the default t() translate functions. Gettext uses () instead of t() however i18n-tasks does not detect this as a key in my views. Is there anyway to tell i18n-tasks that () also signifies a key?
Gleb Mazovetskiy
@glebm
@ceres629 You can override the scanner pattern by inheriting from the scanner and specifying the new scanner in the config. I suggest you use v0.9.0.rc2 for this
@ceres629 For 0.9, the easiest would be to monkey-patch this method https://github.com/glebm/i18n-tasks/blob/0.9-dev/lib/i18n/tasks/scanners/pattern_scanner.rb#L85 and to pass a different receivers: argument to the AST scanner constructor via the config
Colin Browne
@ceres629
many thx! I was able to figure it out thanks to your pointers!
Colin Browne
@ceres629

Is the strict config setting working in 0.9.0? I've added

search:
  strict: false

To my i18n-tasks.yml in my project, but it doesn't have any effect.

Gleb Mazovetskiy
@glebm
@ceres629 That's strange, there is currently a passing test for this https://github.com/glebm/i18n-tasks/blob/0.9-dev/spec/i18n_tasks_spec.rb#L110
@ceres629 Perhaps it's a problem with config parsing, can you please have a look?
Russell Osborne
@rposborne
Quick question I am trying to inject nil values for missing keys vs an empty string any hints on how to achieve this?
found
glebm/i18n-tasks#170
Russell Osborne
@rposborne
I am attempting to write a custom scanner for Spree, using the 0.9.0-rc2 release. Maybe someone can point me in the right direction, Spree uses a helper Spree.t("key") to use the spree namespace in I18n. I have successfully writing a Scanner for this but I am dealing with an overly eager PatterMatcherWithScope that matches these the above call again.
Gleb Mazovetskiy
@glebm
@rposborne Eager matching fixed in glebm/i18n-tasks@f15d762
@rposborne Unfortunately, this did not make it into v0.9.0 release
Gleb Mazovetskiy
@glebm
@rposborne Now released in v0.9.1
Russell Osborne
@rposborne
Awesome thanks! @glebm
souravongit
@souravongit
This message was deleted
souravongit
@souravongit
i installed it on my application. when im trying to run it show error like "i18n-tasks: Error scanning app/controllers/api/v1/bank_branches_controller.rb: undefined methodtransform_values' for {}:Hash
". If i exclude controllers from config/i18n-tasks.yml then it works.mainly not working on .rb file.Please help me out.
Colin Browne
@ceres629
I am trying to add a custom scanner and I'm sure I'm following the method outlined in the readme but I keep getting: i18n-tasks: [DEPRECATED] search.scanner is now search.scanners, an array of [ScannerClass, options] /usr/local/opt/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/inflector/methods.rb:261:inconst_get': uninitialized constant GettextScanner (NameError)`
I put a gist of what I've done here https://gist.github.com/ceres629/c048941009b0b4f0527c
is there a step i'm missing?
Colin Browne
@ceres629
I previously tried to do this before and couldn't get it working, the only thing i got working was to modify the gem itself and add the scanner that way, but I would prefer not to have to do it this way.
Colin Browne
@ceres629
okay silly me, I realise now you either have i18n-tasks.yml.erb or i18n-tasks.yml, not both
putting the contents of the .yml into .yml.erb works fine.
souravongit
@souravongit
hey @ceres629 can you help me
Can you tell me the configuration procedure please
Colin Browne
@ceres629
its just as i have in my updated gist
souravongit
@souravongit
which version of gem you used.and whats your ruby version
in my case it works only views when i include controllers it gives error "i18n-tasks: Error scanning app/controllers/api/v1/bank_branches_controller.rb: undefined methodtransform_values' for {}:Hash"
Gleb Mazovetskiy
@glebm
@ceres629: if you use I18n::Tasks.add_scanner, there is no need to modify search.scanners in the config, as add_scanner adds it to the default scanners.
This message was deleted
@souravongit transform_values is a method coming from activesupport (available since v4.0 I think)
@souravongit Ouch. transform_values is only available since ActiveSupport v4.2.0, but the gem depends on >= v4.0.0.
Gleb Mazovetskiy
@glebm
@souravongit I've opened #178 to track this
Colin Browne
@ceres629
Thanks @glebm removed that line and all works fine.
One question, how would I go about adding support for gettext .po files? I want to export missing keys to the .po format
souravongit
@souravongit
So can you please help me how to fix it .. Thanks.
Billz2me
@Billz2me
why was this gem made backwards incompatible for ruby < 2.0.0 ?
the RubyAstScanner uses new syntax that fails to build with Ruby 1.9