[yast-devel] I18n - added N_() and Nn_() to Yast
Hi all, I just have added N_() and Nn_() gettext equivalents to the latest ruby-bindings (yast2-ruby-bindings-3.1.12). These functions take the same arguments as _() and n_() functions but do *not* translate the strings, they return the original untranslated values. The side effect is that these string are found by gettext when crating POT file and so they can be translated by translators. Of course, to make it fully usable you need to do translation later using _() or n_(). Some examples when this can be used: - translating constants (see [1] for an example) - for logging an untranslated text, but displaying translated text to the user: begin ... # does not translate, the exception contains the untranslated string, # but it's recognized by gettext like normal _() raise FooError, N_("Foo failed.") ... rescue FooError => e # log the original (untranslated) error log.error e.message # but display translated error to the user, # _() does the actual translation Popup.Error(_(e.message)) end This approach can be used whenever you need both original and translated text. Later we could use this to fix Report.Error() to log the untranslated text instead of the translation. Enjoy! [1] https://github.com/webyast/webyast/wiki/Localization#wiki-translating-consta... -- Ladislav Slezák Appliance department / YaST Developer Lihovarská 1060/12 190 00 Prague 9 / Czech Republic tel: +420 284 028 960 lslezak@suse.com SUSE -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
Dne 26.2.2014 14:33, Ladislav Slezak napsal(a): [...]
Some examples when this can be used:
I have added the examples into yardoc comments, see http://rubydoc.info/github/yast/yast-ruby-bindings/master/Yast/I18n#N_-insta... -- Ladislav Slezák Appliance department / YaST Developer Lihovarská 1060/12 190 00 Prague 9 / Czech Republic tel: +420 284 028 960 lslezak@suse.com SUSE -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (1)
-
Ladislav Slezak