Ideal D GUI Toolkit

Diggory diggsey at googlemail.com
Thu May 23 00:29:04 PDT 2013


On Thursday, 23 May 2013 at 07:19:46 UTC, Jacob Carlborg wrote:
> On 2013-05-23 08:27, Peter Williams wrote:
>
>> An example of how I would envisage gettext being used in D is:
>>
>> writefln(gettext("%s: unknown variable at line %s"), filename, 
>> linenumber);
>>
>> It is a common practice, to define a macro (or equivalent) 
>> _(arg) as an
>> alias for gettext(arg) (and N_(arg) for gettext_noop(arg)) 
>> because
>> people like brevity.
>>
>> I would suggest using the gettext() functionality for i18n but 
>> design
>> the notation used within programs (to access that 
>> functionality)
>> according to what best suits the D paradigm.
>
> Is the text you want to translate the actual key? That sounds 
> very stupid. What if I need to change the text?

If you need to change the text then you also need to update the 
translations, or at least check that they're still correct, so I 
see that as a benefit rather than a problem...

What's great about it is you can develop your program with having 
to mess about with keys or anything to do with i18n, just 
remember to call "gettext()" and when your done it's already 
ready for translations to be added. Most other schemes require 
you to create a key before you can do anything which is a massive 
waste of time while developing when you may end up changing it 
numerous times or end up not even needing it.


More information about the Digitalmars-d mailing list