i18n Manual

i18n [-default_language aLanguage][-project_name aProjectName][-i18n_dir someDir] [-lproj_dir dir] command [commandSpecificOptions]

Problematic

Internationalizing a Cocoa application is a labor-intensive task. Nib files and strings files need to be translated, and in the case of nib files that requires InterfaceBuilder, which the person translating needs to be familiar with.

But once an application is translated, the work does not stop: Any change to the user interface now has to be performed in all languages, which is a lot of work, and it is easy to overlook a connection or other change.

i18n is a perl script designed to make internationalizing applications easy and quick. Here are it's advantages:

To use i18n, first use the strings command to generate a strings file for your defaultLanguage. Then use the prepare command to generate string files for your target languages. i18n will automatically apply any translations it learned from previous projects. These are the files your translators need to translate.

Lastly use the generate command to create or update the lproj directories for your traget languages.

Tip: Sometimes the generated nib files do not look right because a string is longer than in the defaultLanguage and does not fit. Rather than changing the generated nib file (which you would have to do after every change), modify the nib file in your defaultLanguage to allow for the longer strings.
Note: Please always run i18n from your project directory. i18n attempts to extract some default values, such as ProjectName from the current directory.

i18n Commands

i18n strings

Extract string files from all nib and strings files in defaultLanguage.lproj. The resulting file will be at i18n_dir/defaultLanguage.strings.

i18n prepare [language [language]]

Takes i18n_dir/defaultLanguage.strings, and translates known terms to the destination language or languages. If no languages are given, files will be generated for the predefined languages (see rc Files). The resulting file or files will be at i18n_dir/language.strings.

i18n generate [language [language]]

Takes i18n_dir/defaultLanguage.strings, and translates known terms to the destination language or languages. If no languages are given, files will be generated for the predefined languages (see rc Files). The resulting file or files will be at i18n_dir/language.strings.

i18n extract targetLanguage

You need this command if you already have localized nib files. extract will create a translated strings file by comparing nib and strings files in your defaultLanguage with nib and strings files in the give targetLanguage.

It assumes you have:

i18n will then prepare a i18n_dir/language.strings file suitable for further use with i18n.

rc Files

Upon startup i18n will read these files:

Use these to define the predefined variables below, either on a global or on a project-specific basis. i18n will create ~/.i18n/rc on it's first run if it does not exist. Simply call i18n without any command.

The files must be in perl syntax. Note that some variables only make sense in a global or project-specific context.

Predefined variables

These can be modified via the rc Files:

$::DEFAULT_LANGUAGE [English]

This is the language you use in your nib and strings files.

@::Languages [none]

use this array to predefine your target languages. this enables you to run the commands prepare and generate without additional parameters.

$::ProjectName

The name of the project, default taken from current project file if found.

$::I18N_dir

Where project specific data is store, defaults to ./i18n if project file found in current directory.

$::Lproj_dir

Directory where the various *.lproj directories are, defaults to the current directory if project file found in current directory.

Files

i18n uses ~/.i18n to store previous translations. It uses i18n/language directories for intermediate files.

License

KeyBindingsEditor is free for personal use. If however you use it frequently or if you would like to support development of quality OS X software, please consider a donation. Start by clicking on the button below. Payment is handled via PayPal, no PayPal account needed and no registration required!

Change Log

Feedback

Please send any feedback and bug reports to support@cocoabits.com
i18n is a product by CocoaBits, a division of bitart