Mailinglist Archive: yast-devel (144 mails)

< Previous Next >
Re: [yast-devel] Converting YCP data files into YAML, continue removing YCP
On Thu, 08 Aug 2013 13:27:25 +0200
Ladislav Slezak <lslezak@xxxxxxx> wrote:

Dne 8.8.2013 11:59, Jiří Suchomel napsal(a):
V Thu, 08 Aug 2013 08:18:01 +0200
Ladislav Slezak <lslezak@xxxxxxx> napsáno:
Still not usable for data files of yast2-country: currently there
are explicitly loaded via target.ycp each time when the language is
changed so the new translation is available during run-time.

I guess we cannot force load the include file when we need to
re-translate those files. Is there any ruby solution for that?

A possible solution could be to wrap the YAML in an ERB template,
in ERB you can put any Ruby code:

foo: <%= _("bar") %>

Then it could be read using


(See e.g.

Ruby Gettext even supports ERB, so it should be easy to extract
translatable strings from ERB files.

But the example is not complete, we would need to "escape" the
translated string to make sure not to break the YAML format...

This looks like reasonable solution,because you need to re-evaluate
file everytime again as it is not trivial to change language set during

Another possibility is to use a user data type feature in YAML, you
can actually convert any object to YAML: => "--- !ruby/object {}\n"

We could create e.g. TranslatableString class which would handle

But in this case extracting the translatable texts from YAML would be
complicated, we would likely need a new specific parser for that.

(BTW in both cases the YAML files became unportable, you cannot read
them using e.g. perl-YAML library or something else. But that should
not be a problem, YCP files were unreadable outside Yast anyway...)

the first solution looks better for me.

I already discussed that in the past with Josef, he told me that it
should be somehow possible to use translations in YAML files. So
let's see when he's back from vacation...

Well, RoR use different solution, that they have file.en.yaml with en
string and file.cs.yaml with different language set and use their own
I18n, so question is if we want to stay with gettext, but probably yes,
to make live easier for translators.

To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >