[PATCH 1/2] Support translating UTF8 strings

Maximilian Güntner maximilian.guentner at gmail.com
Fri Nov 15 07:06:42 UTC 2013


2013/11/15 Dirk Hohndel <dirk at hohndel.org>:
>
>
> I'll write a bit more about this.
>
> With the fixed tag strings we were able to translate into the various
> languages. We can still that with the 'default strings'. But we should
> NEVER run strings that come from a user through the translation process.
> How could we possibly have the correct translations for whatever tag a
> local user comes up with?

Without breaking backward compatibility, there is no way to tell whether a tag
that has been read from the xml file is a default or a custom one.
The only alternative is to hard code all default strings into taglist_add_tag.
Then we could do something like
if default_strings.contain(tag)
  translate(tag);
else
  .... /* don't translate */

The assumption is, that there is no translation for any custom tag in our
translation database. It works since tr/trUtf8() returns the input
string when no
translation is available. This should be true for most of the tags provided
by a user.
Of course, if a user would enter the word "Cylinder" and the language has been
set to German, the tag will be translated to "Flasche" since somewhere in the
application, the string "Cylinder" has been marked for translation.
I think a safer approach would be the alternative that is described above.
Provide a white-list of tags that can be translated and don't
translate the rest.

Maximilian


More information about the subsurface mailing list