Mailinglist Archive: yast-devel (144 mails)

< Previous Next >
Re: [yast-devel] Converting YCP data files into YAML, continue removing YCP
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
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...

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 translations.

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

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

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


Ladislav Slezák
Appliance department / YaST Developer
Lihovarská 1060/12
190 00 Prague 9 / Czech Republic
tel: +420 284 028 960
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups