discuss-gnustep
[Top][All Lists]
Advanced

[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: Fri, 22 Sep 2000 07:05:07 +0200 (CEST)

> Date: Fri, 22 Sep 2000 08:08:51 +0400
> From: Igor Roboul <igor@raduga.dyndns.org>
>
> On Thu, Sep 21, 2000 at 07:00:06PM +0200, Pascal J. Bourguignon wrote:
> > 
> > However, note that the NSBundle macros are more functionnal than that:
> > they allow to associate a comment to a key, to help the translator.
> > 
> >   NSLocalizedString(@"cheese",@"The generic name for the fermented milk 
> > stuff")
> >   NSLocalizedString(@"cheese",@"What you say to smile in a picture")
> > 
> > Translated in  Spanish, for example,  the first will be  translated as
> > @"queso", and the second as @"patata".
> Wow!!!
> That is _really_ cool!!! 
> When I have tried translate some gettext-enabled apps, I had wished something
> like this.

I did not mean that it was an automatic translation tool! 

The process is as follow:

1- You put these lines in a source file:

   NSString* cheese1=NSLocalizedString(@"cheese",@"The generic name for the 
fermented milk stuff");
   NSString* cheese2=NSLocalizedString(@"cheese",@"What you say to smile in a 
picture")


2- You process  this  source  file with  genstrings  (on NEXTSTEP  or
   OPENSTEP), or with get-local-string (for now, on gnustep), and you get
   a "strings" file containing:

/* From a.c */
"cheese" = "cheese"; /* The generic name for the fermented milk stuff */
"cheese" = "cheese"; /* What you say to smile in a picture */



3- You hand this "strings" file  to a translator, you feed him (or pay
   him), he should return you a translated "strings" file such as:

/* From a.c */
"cheese" = "queso"; /* The generic name for the fermented milk stuff */
"cheese" = "patata"; /* What you say to smile in a picture */

   Which file you put in your Spain.lproj subdirectory.


4- You compile your source file. The macros expand to :

   NSString* cheese1= [[NSBundle mainBundle] localizedStringForKey:( @"cheese" 
) value:@"" table: (id)0 ] ;
   NSString* cheese2= [[NSBundle mainBundle] localizedStringForKey:( @"cheese" 
) value:@"" table: (id)0 ] 


5- You configure you language  as Spain, and run the application, then
   the variables will contain:

       cheese1=@"queso"
       cheese2=@"patata"



The point being  that the comments are passed  to the human translator
in the "strings"  files, to let him translate  CORRECTLY, with all the
needed context. That's most important for small strings (a few words).



-- 
__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/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]