glebm / i18n-tasks

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

Normalize moves empty string keys to a new file #579

Open jaredmoody opened 3 months ago

jaredmoody commented 3 months ago

To translate a blank option in a select in simple form, I have a key that is an empty string:

# config/locales/en_US/projects/tax_options.yml
en_US:
  simple_form:
    options:
      project:
        tax_labor:
          '': Use product default
          'false': Do not tax labor on all items
          'true': Tax labor on all items

Normalize is pulling out only the blank key and adding it to a new file at config/locales/en_US/en_US.yml, which I don't want.

I think this is a bug because AFAIU the conservative router is not supposed to move keys, correct?

davidwessman commented 3 months ago

Would be great if you could write a test case for this.

jaredmoody commented 2 months ago

Sure, here's a failing spec:

https://github.com/glebm/i18n-tasks/compare/main...Jetbuilt:i18n-tasks:empty-string-keys-%23579

LMK if you want me to start a PR.

davidwessman commented 2 months ago

@glebm Do you have any suggestion for handling blank keys? The conservative router cannot find a key like es.