Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Localization in Cocoa

 
   Soft32 Home -> Mac -> Programmer Help RSS
Next:  Using bindings with NSButtonCells in NSTableView  
Author Message
Tim R Johnson

External


Since: Aug 13, 2003
Posts: 33



(Msg. 1) Posted: Mon Mar 22, 2004 8:15 pm
Post subject: Localization in Cocoa
Archived from groups: comp>sys>mac>programmer>help (more info?)

I've dealt with the localization aspects of cocoa, and bundles for a while
now, and am wondering how other people are dealing with them.
The solution presented to us is just request all strings through
NSLocalizedString, add a comment, then when you are ready to create a
localizable.strings file, you just run genstrings to create it. Sounds
simple and basic enough, but I see, and have dealt with a few flaws in this
design. Am I the only one?

-First of all I don't like having full strings in my code. I prefer to just
have variable lookups or defines to access specific strings.
-Second, what happens if you have a full string in your code, and its
missing from the .strings file? You now have a string which looks fine in
your local language, but once its localized, you will find all of these
string which have not changed. There is no warning, or any pre determined
idea that this will happen.
Also there is the situation where you have 2 basic strings, which may differ
by grammar, or by sentence structure, but mean the same thing. Genstrings
will add these seperatly and create great fun for the people translating
your redundant sentences.

What I have done to solve these problems is that I use the NSLocaliedString
code, but I pass is a constant as my string, and then in my .strings file
have the constant refer to the full string. This will eliminate all long
strings in the code, enable you to have easily defined strings, and make is
easier to recognized missed strings in your code. This means that you have
to manage your .strings file manually, but that is the way we use to do it,
and it seems a lot easier, and less hassle this way. To me anyways.

Does anyone else have any tips, or suggestions.
Am I the only person who thinks this solution needs a little additional work
just to finish it off?

TRJ
Back to top
Login to vote
it_means_"halo,_then_reso

External


Since: Mar 05, 2004
Posts: 162



(Msg. 2) Posted: Tue Mar 23, 2004 4:24 am
Post subject: Re: Localization in Cocoa [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tim R Johnson wrote:
> I've dealt with the localization aspects of cocoa, and bundles for a
> while now, and am wondering how other people are dealing with them.
> The solution presented to us is just request all strings through
> NSLocalizedString, add a comment, then when you are ready to create a
> localizable.strings file, you just run genstrings to create it. Sounds
> simple and basic enough, but I see, and have dealt with a few flaws in
> this design. Am I the only one?

nope! i think it's hideous. i also think it's pretty dumb that you
have to create a separate set of .nibs for each localization. if you've
got a bunch of them, the slightest change is going to become a
maintenance nightmare. the cocoa localization scheme is easy to use for
small programs, but gets harder and harder as projects become more
complex.

this subject has come up before here, but no one has any solutions. how
could they? you'd have to go against the grain of apple's way of doing
things and reinvent quite a few wheels. that hasn't stopped a few
people from trying ...

cross-platform gui toolkits are up against this same problem, but in a
slightly different way. consider wxWidgets, for example (formerly known
as wxWindows). their aim is to let you compile one codebase for
multiple platforms, including the mac and ms-windows. obviously,
interface builder and macosx's localization scheme are off limits to
them. i only briefly examined wxWidgets before deciding that it wasn't
for me, but i'm pretty sure they store window definitions in XML files,
and there are various interface-builder-like cross-platform tools you
can use to lay out your windows. they get around the multiple .nib
problem by using one XML window file for every language, but forcing
every control and view to grow and shrink as necessary to accommodate
however much text it holds. apple should have done something like that
as well.
Back to top
Login to vote
Uli Kusterer

External


Since: Jun 22, 2005
Posts: 268



(Msg. 3) Posted: Fri Mar 26, 2004 8:29 am
Post subject: Re: Localization in Cocoa [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <PM0003D64ED963E525 RemoveThis @minion.nashville.comcast.net>,
Jøhnny Fävòrítê (it means "halo, then resonate") <this.is RemoveThis @fake.com>
wrote:

> nope! i think it's hideous. i also think it's pretty dumb that you
> have to create a separate set of .nibs for each localization. if you've
> got a bunch of them, the slightest change is going to become a
> maintenance nightmare. the cocoa localization scheme is easy to use for
> small programs, but gets harder and harder as projects become more
> complex.

Have you checked out PowerGlot? Haven't tested its NIB support yet, but
it's an application that keeps a database of translations and will
automatically re-apply them to files.

> they get around the multiple .nib
> problem by using one XML window file for every language, but forcing
> every control and view to grow and shrink as necessary to accommodate
> however much text it holds. apple should have done something like that
> as well.

The GNUstep project has produced something like that. It's called
Renaissance, and it compiles fine on MacOS X. Basically, you specify all
your items, outlet-connections and actions in an XML file with some
hints as to how you want them layouted, and the Renaissance framework
will take care of loading the appropriate views and arranging them so
they fit their text.

There's no graphical builder for it yet, but it produces very readable
XML.

Cheers,
-- Uli
http://www.zathras.de
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Considering Cocoa Books - I'm not doing well with the existing documentation that comes with Xcode. I've also found the currency converter app t...

[Cocoa] : 'Spreadsheet' Control? - Hello all, Does anyone have a good idea of how to implement a spreadsheet type of control in Cocoa, or know of any sou...

[Cocoa] Bug with NSTableView? - Hello all, I have a small yet significant problem, and I can't figure out for the life of me, why it's happening. I...

Icons in cocoa menus?? - Hey all-- I poked around the developer docs and on Apple's web site, but it looks as though NSMenu doesn't natively s...

Q About Cocoa & CF Prefs.. - It is my understanding that when you use the core foundation calls to write to an application's preferences, those pre...

java, MacOSX, and Cocoa - I just bought my first Mac, and I have been using it for server side java development. This is working just fine. I ...
       Soft32 Home -> Mac -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
  Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]