Problem with i18n("")
Ansley, Michael
Michael.Ansley at intec.co.za
Fri Oct 8 14:30:09 BST 1999
Thanks. I should actually have realised that. It's basically the same as
the translation software we use on Win32.
MikeA
>> -----Original Message-----
>> From: Jacek Wojdel [mailto:wojdel at kbs.twi.tudelft.nl]
>> Sent: Friday, October 08, 1999 12:48 PM
>> To: kdevelop at barney.cs.uni-potsdam.de
>> Subject: RE: Problem with i18n("")
>>
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>>
>> On Fri, 08 Oct 1999, you wrote:
>> > That's fine, but what if I do i18n(text_var); and text_var
>> evaluates to ""?
>> > Writing a check to see if text_var is empty would seem a little
>> > counter-intuitive, as well as unnecessary, if i18n() gave
>> the correct
>> > output.
>>
>> IMHO, you shouldn't ever use i18n(text_var). The point is
>> that the argument of
>> i18n call should be a constant string that can be evaluated
>> at compile time,
>> and it should be present right in the point where i18n is
>> called. So assume you
>> want to internationalise the following code:
>>
>> if (comning)
>> strcpy(text_var, "Hello !");
>> if (going)
>> strcpy(text_var, "Bye !");
>> printf(text_var);
>>
>> You should do it as follows:
>>
>> if (comning)
>> strcpy(text_var, i18n("Hello !") );
>> if (going)
>> strcpy(text_var, i18n("Bye !") );
>> printf(text_var);
>>
>> However if you're tempted to do something like this:
>>
>> strcpy( text_var, "Hello ");
>> if (global)
>> strcat( text_var, "world.");
>> else
>> strcat( text_var, "user.");
>> printf( text_var );
>>
>> The only proper way to do it is:
>>
>> if (global)
>> strcpy( text_var, i18n("world.") );
>> else
>> strcpy( text_var, i18n("user.") );
>> printf( i18n("Hello %s"), text_var );
>>
>> And as a final note, from the translator's perspective it
>> could be the best if
>> you could avoid using any runtime-generated text in
>> communication with user, so
>> always instead of concatenating "File", filename, "couldn't
>> be open" use
>> sprintf with i18n("File %s couldn't be open").
>> Jacek
>>
>> --
>> +-------------------------------------+
>> |from: J.C.Wojdel |
>> | J.C.Wojdel at cs.tudelft.nl |
>> +-------------------------------------+
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: PGPfreeware 5.0i for non-commercial use
>> MessageID: 3BkhkWZuZw7hf6gHZ2MH50ZQUwbL2sq9
>>
>> iQCVAwUBN/3QXIWy7tU6a5rbAQGecgQAuM/r8UIkMZ3dzM3wbrAegIes4JyaD7uC
>> AF6gi3FHWdkPOpYQr0nl9O9R7yV5x2uVhbvha7CNOYZGNCH26qZwZ28dZ5EUAU/+
>> Wi5Hxo199lcjT9y2D1GrJiR/BerN7Cac8aLMqu+TSpLdyOdXJHkyfGl6FDNWLlEW
>> co/1dDREHu0=
>> =TgZY
>> -----END PGP SIGNATURE-----
>>
More information about the KDevelop
mailing list