internationalization of an iPhone Application

前端 未结 4 1916
夕颜
夕颜 2021-01-27 10:45

I am new to iPhone App development (I am using XCode 4.2) and I was wondering if there is a way to translate all the strings , caption etc ... internally without having to trans

4条回答
  •  余生分开走
    2021-01-27 11:15

    You can read a step-by-step tutorial of the process here:

    iPhone Localization Tutorial

    Here's a high-level overview of the basics (the above tutorial has details):

    1) Change all your coded strings to call: NSLocalizedString(@"My text", @"Context for the translator")

    2) Export all your strings using the genstrings Terminal command.

    3) This creates a text file called Localizable.strings with all your English (source) strings. It looks like this:

    /* Context for the translator */
    "My text" = "My text";
    

    You send that file to the translators. They'll translate the right side like this: "My text" = "Mi texto";

    4) You place each translated Localizable.strings file in its proper language folder: en.lproj, fr.lproj, es.lproj, etc.

    When your app loads on the iPhone it will check the user's language settings. If the user has chosen French as the system language, the Localizable.strings inside your fr.lproj folder file will load. If there are any untranslated strings, it just defaults to English (or whatever your source language is) for those.

    It's worth following the whole tutorial and note that the file/folder names have to be exact!

提交回复
热议问题