Internationalization support and format strings
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Tue Mar 25 00:36:08 UTC 2025
On 25/03/2025 11:39 AM, Bruno Haible wrote:
> Hi,
>
> The GNU gettext package contains tools for internationalization,
> enabling a programmer to make their package "speak" to the users in
> their specific language.
>
> GNU gettext so far supports a number of programming languages, see
> https://www.gnu.org/software/gettext/manual/html_node/List-of-
> Programming-Languages.html
>
> I thought it would be a good idea to make GNU gettext support also the D
> programming language. This is a registered wish list item since 2017:
> https://savannah.gnu.org/bugs/?51291 . On the D side, a rudimentary
> interface to the gettext() function in the GNU C library exists as well:
> https://code.dlang.org/packages/libintl
>
> I am now trying to implement this support. I am already done with the
> xgettext support (parsing D source code and extracting messages). But
> from the programming language, this support also needs format strings
> with positions (so that translators can reorder arguments in their
> translations of format strings).
>
> D has format strings in its standard library (phobos): https://
> dlang.org/library/std/format.html
> But this format string facility has 4 major bugs:
> https://github.com/dlang/phobos/issues/10699
Needs to be discussed.
Requires sentinel value, and right now its typed as a ubyte.
> https://github.com/dlang/phobos/issues/10711
I think its more that docs are wrong here, rather than implementation.
> https://github.com/dlang/phobos/issues/10712
I'm not sure about this one, it looks funky, but at least its easy
enough to work around with.
I'll leave it to someone else.
> https://github.com/dlang/phobos/issues/10713
https://github.com/dlang/phobos/pull/10714
More information about the Digitalmars-d
mailing list