i18n-tasks
i18n-tasks copied to clipboard
The comments are being removed when running :normalize
We are using comments in our master translation file (en.yml) in order for them to be used on Lingohub and help translators understand the context of the string. Eg.
# This string is a general error message and will appear below an input field without any other text before or after. It refers to the value the user entered in the input field.
confirmation: "doesn't match %{attribute}"
When running the normalize commands and the keys are being sorted the comments above them are gone. Is there any way you could add an option to keep the comments or make it the default behaviour?
This gem uses Psych for parsing which does not preserve comments, so I don't see an easy way to do this but you're welcome to try.
I got the same problem.
Since we're in a stage that managing keys by hand is not feasible. I created this crude tool to stash comments, and pop them back again after running the tasks. It's a work in progress...
If someone has similar problems, it would be great to join efforts to get this into a stable state. https://github.com/sergioisidoro/yashter
I have a similar problems with kind of preserving "front-matter" (e.g. license information). That should be easier to implement (copy the x lines at beginning of file that are yaml comments, run psych, re-add everything that was a yaml-comment).
The gem depends on Psych, which depends on libyaml, which currently doesn't support parsing and writing comments; ftr https://github.com/yaml/libyaml/issues/42 is the upstream issue to watch.
Has anyone come up with a clever way of managing the 'contexts' of the strings-to-be-translated?
I was considering maybe using a similar method of adding context or notes via comments...
Similar to the # i18n-tasks-use strategy for marking usages.
Like, you could have a comment such as
<%# i18n-tasks-comment c('en.translation.key', 'Here is a quick note in English') %>
that could then be collected and also exported alongside keys for translation etc. Related to this issue, in that the comments about the strings could never be lost, as they are stored inside the views.