Re: Loading a localized tiff file: how to?
Re: Loading a localized tiff file: how to?
- Subject: Re: Loading a localized tiff file: how to?
- From: Ondra Cada <email@hidden>
- Date: Wed, 13 Mar 2002 14:44:28 +0100
Michele,
>
>>>>> Michele Garoche (MG) wrote at Wed, 13 Mar 2002 08:22:45 +0100:
MG> I'm trying to load an NSImage localized to French (the image is kind of
MG> text saved as tiff, so I need localization for it).
MG>
MG> In PB, I've imported both tiff's (one for English, the other for French
MG> languages) within the resources folder.
MG> In the project directory, one file is in the English.lproj, the other in
MG> the French.lproj.
Right.
MG> In the custom controller class, I wrote in the
MG> applicationDidFinishLaunching method:
MG>
MG> if (![NSImage imageNamed: NSLocalizedString(@"Foo", @"")])
Wrong. The way to go is
(i) I can't check just now, but I *think* that imageNamed: grants
localization by itself. Just plain
[NSImage imageNamed:@"Foo"]
then should work: if there is no Foo.tiff (or so) in Resources, it should be
found in the appropriate <language>.lproj.
(ii) if it happens not to work (I'd be surprised, but who knows), then you
can for sure solve it using -[NSBundle pathForResource:ofType:]
(iii) Don't:
>
>>>>> Nick Muller (NM) wrote at Wed, 13 Mar 2002 08:38:19 +0100:
NM> But I would do it the way you startet:
NM>
NM> In the french localizable.strings:
NM> "Foo" = "FooFR";
NM>
NM> .... the english
NM> "Foo" = "FooUS";
NM>
NM> .... and then name the localized pictures FooUS.tiff and FooFR.tiff.
NM> Note, that you can't load the pictures in IB, you have to do it by code.
This would work, but is unnecessarily complicated and ugly, making you to
implement your own localization code instead of just using the framework one.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.