C++ Logo


Advanced search

Re: [SG16-Unicode] Ideas for the future

From: Niall Douglas <s_sourceforge_at_[hidden]>
Date: Tue, 30 Jul 2019 17:42:44 +0100
> I agree that having a (defacto) standard way of specifying translatable
> strings would be very helpful. Is anyone aware of prior proposals or
> widely adopted alternatives to POSIX/GNU gettext? I have some
> experience with Microsoft's resource DLLs for providing string
> translations (and have implemented a similar system on non-Windows
> platforms), but lack other experience. Anyone interested in working on this?

Our shiny new std::format() intends to support named arguments in the
future. This still isn't quite enough, gender agreement across
adjectives etc might vary depending on numeric value inserted.

Still, that's where I'd start, by proposing a named argument extension
for std::format() which allows the translation to vary depending on the
number or word inserted. I'd probably select which translation to use
based on regex matching.

There is a still nastier way of doing this. In the past, I had a program
generate many permutations of user facing strings with various parameter
value inserts, feed those to Google Translate, and then programmatically
generate a table of "best" translations based on variations of
translation according to parameter value insert.

Awful. But better than gettext()-like systems by far. Russian speakers
in particular seemed to like my translations, something to do with
numbers having gender or something.

Note that I have no experience of users from Asia nor Africa, and can
say nothing about whether this technique works for those languages as well.


Received on 2019-07-30 18:42:47