Proof of concept: automatic extraction of gettext-style translation strings
Sönke Ludwig
sludwig+d at outerproduct.org
Thu Apr 2 15:53:58 UTC 2020
Am 02.04.2020 um 15:04 schrieb Adam D. Ruppe:
> On Thursday, 2 April 2020 at 13:01:09 UTC, H. S. Teoh wrote:
>> This morning a neat idea occurred to me for a gettext-like system in D
>> that allows automatic and reliable extraction of all translation
>> strings from a program, that doesn't need an external parser to run
>> over the program source code.
>
> Indeed, I have played with this before, it is really cool.
>
> I almost wrote it as an example of my string interpolation proposal,
> since with my proposal, it would be possible to run this over i""
> strings passed to a particular function too.
>
> D rox.
I'm doing the same in my UI framework. In addition to being able to
collect all strings at compile-time, it is also possible to translate
and verify the existence of strings at compile-time by loading and
parsing the PO-files with CTFE.
BTW, I never got around to commenting on the string interpolation topic,
but the inability to translate i"" strings was my biggest practical
concern. Never really understood the reluctance against lowering to a
template instantiation, though.
(PS: nevermind the e-mail, I can't handle my e-mail client properly)
More information about the Digitalmars-d
mailing list