[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnustep] Localization
From: |
Nicola Pero |
Subject: |
Re: [Discuss-gnustep] Localization |
Date: |
Thu, 21 Sep 2000 22:02:17 +0200 (CEST) |
>
> > How about this -
> >
> > #define _(X) \
> > [[NSBundle mainBundle] localizedStringForKey: @#X value: nil table: nil]
> >
>
> Nice. What about
>
> #define @_(X) \
> [[NSBundle mainBundle] localizedStringForKey: @#X value: nil table: nil]
Ahm - now I rememeber more clearly the trick - it's more difficult than
this. We need to think also about static strings and similar. We then
need something like
static NSString *string = @__(Message);
where @__(Message) expands simply to @"Message" in this case.
(Expanding it to [[NSBundle mainBundle] etc would not compile.)
The @__ (or some other similar symbol) is needed because it would be used
by the tool creating the list of strings to be localized in the
Localizable.strings file.
Then, when you access the string, you use @_() on the symbol, and that
will really expanded the string and give the translation.
Also, this allows more advanced people to use the OPENSTEP syntax and
features, like doing the translation manually or looking in other tables
or using comments etc and still allow the tool to find out which
strings need to be put in the Localizable.strings file.
For example,
NSString *myString = NSLocalizedString (@__("Hi"), @"Common greeting");
(or any more complicated function or method call).
@__("Hi") would expand to @"Hi" but mark @"Hi" as a string needing
translation (while @"Common greeting" is not marked as such).
Of course the tool would mark all @_() strings as needing translation
automatically.
- [Discuss-gnustep] Localization, Igor Roboul, 2000/09/21
- Re: [Discuss-gnustep] Localization, Nicola Pero, 2000/09/21
- Re: [Discuss-gnustep] Localization, Adam Fedor, 2000/09/21
- Re: [Discuss-gnustep] Localization, Jonathan Gapen, 2000/09/21
- Re: [Discuss-gnustep] Localization, Nicola Pero, 2000/09/21
- Re: [Discuss-gnustep] Localization, Pascal J. Bourguignon, 2000/09/21
- Re: [Discuss-gnustep] Localization, Nicola Pero, 2000/09/21
- multiple messages Was: Re: [Discuss-gnustep] Localization, Dan Pascu, 2000/09/21
- Re: multiple messages Was: Re: [Discuss-gnustep] Localization, Humasect, 2000/09/21
- Re: multiple messages Was: Re: [Discuss-gnustep] Localization, Stephen G. Walizer, 2000/09/21
- Re: multiple messages, Pascal J. Bourguignon, 2000/09/22
- Re: [Discuss-gnustep] Localization, Pascal J. Bourguignon, 2000/09/22