i18n-tasks
i18n-tasks copied to clipboard
Import / Export with reference key problem
Hi, I am using i18n reference keys in my .yml file e.g.
en: greetings: hello: hello hello_again: :greetings.hello
The problem I am running into is when I export the translations to a csv file the hello_again value is having the colon removed so its no longer a reference value.
If I then manually go into the csv and add back in the : to make it :greetings.hello and then import the translation I now end up with double quotes around the reference (like below)
en: greetings: hello: hello hello_again: ":greetings.hello"
Has anyone run into this problem before, anyone got any tips on how to export/import translation values that reference other values?
Hi Simon,
Have updated the import export gist to include this commented line near the end of the csv_import method:
# translations.map! { |t| [t.first, (t.last&.=~ /^(?=.*\.)[a-z0-9_\.]+$/) ? t.last.to_sym : t.last] }
Uncomment this in order to attempt to recognise entries that are likely reference keys (symbols) pointing to other translations, intended to be rendered in your .yml with a preceding colon.