discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Localization with the '_(X)' macro


From: Paul Chany
Subject: Localization with the '_(X)' macro
Date: Wed, 23 Jun 2010 11:31:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Richard Frith-Macdonald <richard@tiptree.demon.co.uk> writes:

> On 22 Jun 2010, at 14:59, Paul Chany wrote:
>> I'm trying to localize the Window.app Renaissance application so that
>> every string that an user can see be localized.

I mean here the text that sould be print to the xterm window.

> In this case you have a line of code saying 'printf("Hello!\n");' and
> you want to use a localized version of the string. 

Yes.

> Firstly you need to change to use a function which works with NSString
> objects rather than C-strings. 
> eg.
> GSPrintf(stdout, @"Hello!\n");
>
> Then you need to deal with localization.  The standard way to do that
> in GNUstep is using the '_(X)' macro (which is a shorthand for a more
> longwinded localization call: 'NSLocalizedString (X, @"")' ).
> eg.
> GSPrintf(stdout, _(@"Hello!\n"));
>
> That loads localised strings from the default localisation file of the
> application. 

OK I have now in my main.m the following code:
[snip..]
@implementation MyDelegate : NSObject 

- (void) printHello: (id)sender
{
  GSPrintf(stdout, _(@"Hello!\n"));
}

- (void) applicationDidFinishLaunching: (NSNotification *)not;
{
  [NSBundle loadGSMarkupNamed: @"Window"  owner: self];
}
@end
[..snip]

I have run make_strings and get Localizable.strings both in
Croatian.lproj and in Hungaria.lproj directories. eg.:
[snip..]
/***
Croatian.lproj/Localizable.strings
updated by make_strings 2010-06-23 11:00:46 +0200
add comments above this one
***/


/*** Unmatched/untranslated keys ***/

/* File: main.m:37 */
/* Flag: untranslated */
"Hello!\n" = "Hello!\n";
[..snip]

Then I edited these files and change like this shown bellow:
(change the Flag to 'translated' and translate 'Hello' to 'Dobar dan')

[snip..]
/* File: main.m:37 */
/* Flag: translated */
"Hello!\n" = "Dobar dan!\n";
[..snip]

After that I run make and get Window.app without errors and warnings.
But when I run Window.app in Hungarian or Croatian Environment it still
print 'Hello!' instead of 'Jó napot' or 'Dobar dan!' on the xterm. What
am I missing here? 

Any advices will be appreciated!

-- 
Regards,
Paul Chany
You can freely correct my English.
http://csanyi-pal.info




reply via email to

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