[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnustep] Localization
From: |
Pascal J. Bourguignon |
Subject: |
Re: [Discuss-gnustep] Localization |
Date: |
Sat, 23 Sep 2000 02:20:12 +0200 (CEST) |
> From: Lele Gaifax <lele@seldati.it>
> Date: Fri, 22 Sep 2000 10:08:45 +0200 (CEST)
> >>>>> On Fri, 22 Sep 2000 07:05:07 +0200 (CEST), "Pascal J. Bourguignon"
> >>>>> <pjb@imaginet.fr> said:
>
> PJB> The process is as follow:
>
> PJB> 1- You put these lines in a source file:
>
> PJB> <snip>
>
> PJB> /* From a.c */
> PJB> "cheese" = "queso"; /* The generic name for
> PJB> the fermented milk stuff */
> PJB> "cheese" = "patata"; /* What you
> PJB> say to smile in a picture */
>
> PJB> Which file you put in your Spain.lproj subdirectory.
>
>
> PJB> 4- You compile your source file. The macros expand to :
>
> PJB> NSString* cheese1= [[NSBundle mainBundle]
> PJB> localizedStringForKey:( @"cheese" ) value:@"" table: (id)0 ]
> PJB> ; NSString* cheese2= [[NSBundle mainBundle]
> PJB> localizedStringForKey:( @"cheese" ) value:@"" table: (id)0 ]
>
> I still miss the point: in which way lSFK does differentiate between
> the two "cheese"? The only way I see is when in some way it uses also
> the given comment to select the right translation. Shouldn't
> NSLocalizedString() pass also the comment to
> localizedStringForKey:value:table:?
I'll shamefully acknowledge that my examples and understanding come
from NeXTSTEP, and you're making me realize that the NeXTSTEP
localization macros (NXLocalizedString*) have one more parameter than
their OPENSTEP conterparts.
Anyway, you're right: If the key is the same (and the table and bundle
too), then only one entry will be selected. I've not thought of that
consciously, but perhaps it's for this reason I didn't use the
"original language word or sentense" as key, but the name of the macro
I was defining to hold the localized string :
#ifdef NeXTSTEP_3_3
#define sE_PoliceNonDisponible NXLocalizedStringFromTable(@"Mention",\
@"sE_PoliceNonDisponible",\
@"La police Postscript '%s' n'est pas disponible. L'affichage "\
@"du texte de la mention se fera dans la police par défaut.",\
@"Message indiquant l'absence d'une police Postscript impliquant "\
@"l'affichage du texte de la mention dans la police par défaut. "\
@"Le champ %s sera remplacé par le nom de la police Postcript "\
@"manquante.")
In our cheese example, that would be:
#define s_cheese_as_food NXLocalizedString(@"s_cheese_as_food",\
@"cheese",\
@"The generic name for the fermented milk stuff")
#define s_cheese_as_smile NXLocalizedString(@"s_cheese_as_smile",\
@"cheese",\
@"The generic name for the fermented milk stuff")
Of course, there was then no problem, because the strings file was
generated as:
/* From a.c */
"s_cheese_as_food" = "cheese"; /* The generic name for the fermented milk stuff
*/
"s_cheese_as_smile" = "cheese"; /* What you say to smile in a picture */
Which would be translated to:
/* From a.c */
"s_cheese_as_food" = "queso"; /* The generic name for the fermented milk stuff
*/
"s_cheese_as_smile" = "patato"; /* What you say to smile in a picture */
#endif // NeXTSTEP_3_3
Now, with the OPENSTEP macros for localization, since the value is no
more taken as parameter, we have a problem. I don't understand why
they removed it, because it prevent the programmer to insert a default
language in the source file, and as you pointed, the key cannot be
used because of the homonyms.
Perhaps they did that to make one more reason to keep and write the
comment everytime, because now, the programmer should put in the
comment the intended default language sentense, in addition to the
context description:
#ifdef OPENSTEP
#define s_cheese_as_food NSLocalizedString(@"s_cheese_as_food",\
@"'cheese' The generic name for the fermented milk stuff")
#define s_cheese_as_smile NSLocalizedString(@"s_cheese_as_smile",\
@"'cheese' The generic name for the fermented milk stuff")
generated as:
/* From a.c */
"s_cheese_as_food" = "s_cheese_as_food"; /* 'cheese' The generic name for the
fermented milk stuff */
"s_cheese_as_smile" = "s_cheese_as_smile"; /* 'cheese' What you say to smile in
a picture */
Which would be translated to the "default" language as:
/* From a.c */
"s_cheese_as_food" = "cheese"; /* 'cheese' The generic name for the fermented
milk stuff */
"s_cheese_as_smile" = "cheese"; /* 'cheese' What you say to smile in a picture
*/
Which would be translated to other language as:
/* From a.c */
"s_cheese_as_food" = "queso"; /* 'cheese' The generic name for the fermented
milk stuff */
"s_cheese_as_smile" = "patato"; /* 'cheese' What you say to smile in a picture
*/
#endif // OPENSTEP
> I think event gettext is weak on this: its tools even compact the
> "strings" equivalent by eliminating duplicated entries, since AFAICT
> it cannot make any difference between two messages like above...
>
> thanx, and bye,
> lele.
--
__Pascal Bourguignon__ PGP Key ID: 0xEF5E9966
mailto:pjb@imaginet.fr PGP fingerprint: 00 F5 7B DB CA 51 8A AD 04 5B
http://www.imaginet.fr/~pjb/ 6C DE 32 60 16 8E EF 5E 99 66
() Join the ASCII ribbon campaign against html email and Microsoft attachments.
/\ Software patents are endangering the computer industry all around the world.
Join the LPF: http://lpf.ai.mit.edu/ http://petition.eurolinux.org/
- Re: multiple messages Was: Re: [Discuss-gnustep] Localization, (continued)
- Localization (summary?), richard, 2000/09/22
- Re: [Discuss-gnustep] Localization, Pascal J. Bourguignon, 2000/09/21
- Re: [Discuss-gnustep] Localization, Pascal J. Bourguignon, 2000/09/21
- Re: [Discuss-gnustep] Localization, Igor Roboul, 2000/09/22
- Re: [Discuss-gnustep] Localization, Pascal J. Bourguignon, 2000/09/22
- Re: [Discuss-gnustep] Localization, Lele Gaifax, 2000/09/22
- Re: [Discuss-gnustep] Localization,
Pascal J. Bourguignon <=
- Re: [Discuss-gnustep] Localization, Jonathan Gapen, 2000/09/21
- Re: [Discuss-gnustep] Localization, richard, 2000/09/21
- Re: [Discuss-gnustep] Localization, Jonathan Gapen, 2000/09/21
- Re: [Discuss-gnustep] Localization, richard, 2000/09/22
- libxml problem, Pierre-Yves Rivaille, 2000/09/21
- Re: libxml problem, richard, 2000/09/21
Re: [Discuss-gnustep] Localization, Frederic Stark, 2000/09/21
Re: [Discuss-gnustep] Localization, Igor Roboul, 2000/09/21