I am working on extracting strings from the code base. Bryan already
started this effort and I am working on hard to finish it.
I have noticed that Bryan extracted strings from many exception
raise _("Not implemented")
The issue I have is I saw we sometimes work with these messages.
rescue => e return case e.to_s when "Must provide an operating systems" _("Unable to find templates As this Host has no Operating System") else e.to_s end end
(Try to grep for "case e" or "if e" to see more of these)
Now, I would like to discuss which approach should I commit to:
a) Translate all exception names except those which are being handled
programmatically. The issue I have with this option is this can be tough to
watch and there is a danger to miss few and bring some regressions in.
b) Do not translate any exception messages. The issue here is (I
believe) exceptions does get propagated into the UI so users would see
some messages in plain English.
c) Only mark them for translation and translate them programmatically
during rendering them to the screen. So all exceptions should look like
raise N_("Not implemented")
That's how to mark a string for translation but not to actually
translate it. And then I would need to find the code where all the
exceptions are being put on a page where I would do:
So it gets translated. I see this as the best option if there are just
few places where we can put the above snippet.
This should be relatively easy to check using a i18n-checker tool which
I am going to implement (will use Ivan Necas one from Katello). It
searches for _(…) uses in incorrect format (e.g. "unfriendly"
formatting of strings like "%s failed: %s" when translator does not know
what is what and is unable to swap them).
Lukas “lzap” Zapletal