i18n-tasks icon indicating copy to clipboard operation
i18n-tasks copied to clipboard

"normalize" destroys stuff like &defaults

Open jmuheim opened this issue 10 years ago • 3 comments

I often use stuff like the following:

de:
  activerecord:
    attributes:
      defaults: &defaults
        created_at: 'Erstellt am'
        updated_at: 'Aktualisiert am'
      user:
        <<: *defaults
        current_password: Aktuelles Passwort

Sadly, when doing i18n-tasks normalize, these are "flattened". Is there any way to circumvent this?

jmuheim avatar May 03 '14 10:05 jmuheim

Perhaps there is a YAML parser mode that can round-trip this, but I am not aware of one. Related discussion on StackOverflow.

glebm avatar May 03 '14 12:05 glebm

something similar happens here:

  insulin_dose:
    dose: &dosis Dosis
    bolus: Snelwerkend
    application_time: &toegediend Toegediend

becomes:

  insulin_dose:
    application_time: Toegediend
    bolus: Snelwerkend
    dose: Dosis

so references got lost.

bertBruynooghe avatar Dec 21 '16 15:12 bertBruynooghe

@bertBruynooghe Yes, it's the same thing, the YAML parser can't round-trip this. But in your case you should just use reference keys instead, e.g.:

en:
  some_other_key: :insulin_dose.dose

glebm avatar Dec 21 '16 15:12 glebm