Friday, October 10, 2008

Internationalization with Cocoa

So It looks like 2/5's of my downloads are from outside of the US, and the majority of my initial comments are Internationalization related. So, I looked to internationalize, and it is as easy as it should be! But most of the Documentation is Reference based, not examples. And well, I much prefer to steal and refactor examples than to understand and learn, so I put these forth for future Internationalization people to steal from!

This Document Is the official documentation for Internationalization. Good, dry reading.

These 3 steps are all I needed to do:

1) Convert XIB files:
- Internationalize XIB files. Select the XIB file in XCode, click the info button, and under general press 'Make Localized'
- Extract strings: ibtool -L MainWindow.xib > ./MainWindow.strings
- Translate: See Post below!
- Re-create new XIB File:ibtool -d de.lproj/MainMenu.strings English.lproj/MainMenu.nib -W French.lproj/MainMenu.nib
2) Use NSLocalizedString wherever you have a user-visible string to display
- Modify Code to use NSLocalizedString
- Generate a Localized.strings file auto-matically with: genstrings -o t1 *.m
This tool is very cool, it actually parses your code and looks for where you use NSLocalizedString and it generates your key/value pairs from the code!
- Translate and copy Localized.strings into the .lproj directories
3) Use the Localized interfaces on any API objects you have.
- For me, the only object was the NSNumberConverter. I was using a direct number converter, and I realized that it took care of things for all locales even easier!

formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setLocale:[NSLocale currentLocale]];




I applaud Apple in their toolchain. It's great that I can develop great user-friendly Apps in a developer-friendly environment!

Anyone else have any Internationalization Tips?

10 comments:

Kevin Pammett said...

Very neet tool. A little hard for me to believe that it's as simple as that, but I'm 'sure' that's just my experience of the way things "used to be" talking, not anything up-to-date.

Good luck with this!

Thanks -
- Kevin Pammett
|+++++++++++++++++++++++++++++++
| email : Kevin.Pammett@DigitalMediaMagik.com
| LinkedIn: http://www.linkedin.com/in/KevinGenePammett
| work: http://www.DigitalMediaMagik.com/
| home: (978) 448-9088; cell 978 877-6337
| blog: http://blog.DigitalMediaMagik.com/
|-------------------------------

Unknown said...

Hi Tally Up is very good

the french translation is not perfect :

can you change :

Nouveau dépense : Nouvelle dépense

déchiré par : divisé par

Thank you for this great tool

Rv melaqua@online.fr

aj. said...

seems like you didn't update this blog for a year. I don't know if you'r going to make this app works for new firmware.
I like this app very much but have some problem on my iphone 3gs - firmware 3.1.2
it works good after install.. but the day after that, Tally up keep shut down after try to input "name" in either new tally or people name.

could you help?
please email for support, I'd appreciate.

King Brian said...

I'll have to check for a crash dump with apple, but it worked fine on my phone (3gs/3.1.2). The only crash I know of is upgrading from an earlier version.

Is there anything you did that might of aggregated this? If you re-install it should work again. It would be great if you could find out what you did to cause it.


Thanks for your patience! Did I meet you at the VTM conference?


Brian

King Brian said...

Oh, and post your email and I'll get in touch with you directly.

Unknown said...

Hi!

I love Tally Up. I always use it whenever my friends and I go out. Would like to suggest though for the app to be able to generate a csv file so I can send a more easy-to-read file. Currently what I do now is input stuff in Tally Up then manually type in the results to an excel spreadsheet so I can format it.

Thanks and more power!
Meenah

King Brian said...

Glad you're enjoying it! I'll add that to the list of features for next release.


Brian King

Unknown said...

Hi, my Tally-up stopped working. It doesn't allow me to add new logs or see the info in the existing logs. The first screen comes up, but from there when i select anything it just quits. I don't want to just delete it and reinstall it because I would lose the info in it. Any suggestions?

Dagmar said...

My Tally up stopped working. The first screen comes up, but from there anything i select causes is to quit. i can't view the current logs or add new ones. Is there any way to fix it that preserves the information in it? Thank you.

Unknown said...

Hi,many websites still use css for text formatting only, while using tables for Web Design Cochin layout. Ultimately, the maintainability and appearance of a web page is more a function of the skill and organization of the author, rather than whether tables or CSS are used.Thanks....