How to Localize All Your iOS Apps into 20 Languages ​​in 5 Minutes

original post

Foreword

In the modern world, the demand for mobile applications used by people from different countries and regions has increased significantly. It is important for developers to make their applications available in multiple languages. Localizing an application can offer many benefits:

  • Audience expansionA: By localizing your app you can reach users who cannot speak your app’s default language. This can help you tap into new markets and grow your user base.

  • User Experience Improvement: Users are more likely to use and enjoy an app that is available in their native language. Localizing your app can help you provide a better user experience, which can lead to better reviews, rankings, and retention rates. Localizing your application can give you a competitive edge in regions where your competitors may not have localized their applications.

  • Increasing incomeA: Localizing your app can lead to higher revenue because users are more likely to make in-app purchases or pay for subscriptions if the app is available in their native language.

But there are also a few problems and potential issues that developers may run into. Localization can take a lot of time and resources, especially for apps with a lot of content and a long list of supported languages.

But we wouldn’t be developers if we always tried to automate everything. Automated localization can translate content quickly and efficiently, reduce the costs associated with manual translation, such as hiring professional translators or dedicating in-house resources for this task. This is especially effective if the application is being created by a single developer.

Prepare your project

I won’t go into details on how string localization works in xcode projects, there are already many other tutorials on the subject. I will just highlight a few key steps:

  1. Create a Localizable.strings file and fill it with the strings you want to localize.

    /* optional description */
    "[key]" = "[string]";
    /* Example: */
    "welcome text" = "Welcome to XCodelocalize";
  2. Go to project file settings, add desired languages. Apple recommends EFIGS (English French Italian German Spanish) + Chinese as a base.

  3. Create Localizable.strings files for all selected languages. You will most likely also want to localize the plist, storyboard, and intentdefinition files.

Installing XCodeLocalize

Unexpectedly, the iOS development tool turned out to be written in python, so make sure you have python 3.9+

After that you can install xcodelocalize with pip:

pip3 install xcodelocalize

Installation from a .whl file is also available on the page releases or with poetry from source.

Start automatic localization

cd to the project root folder and run

xcodelocalize [OPTIONS]

or

python3 -m xcodelocalize [OPTIONS]

Options

  • --base-language: language code from which all strings will be translated. [по умолчанию: ‘en’]

  • --override / --no-override: boolean value; specifies whether strings that already exist in the file will be translated. translate if override; skip if no-override. [по умолчанию: no-override]

  • --format-base / --no-format-base: sort the lines of the base file by key. [по умолчанию: no-format-base]

  • --file: Names of .strings files to translate. You can specify multiple files. If not specified, all files will be translated. [по умолчанию: None]
    Example:

    xcodelocalize --file InfoPlist
    xcodelocalize --file InfoPlist --file MainStoryboard --file Localizable
  • --key: Keys to be translated. You can specify multiple keys. If not specified, all will be translated. [по умолчанию: None]

  • --language: Code of languages ​​to be translated. Multiple values ​​are allowed. If not specified, all files will be translated. [по умолчанию: None]

  • --log-level: One of [progress|errors|group|string]. [по умолчанию: group]

  • --help: Parameter information

Automation

You can go to Target -> Build Phases -> New Run Script Phase in your Xcode project and enter xcodelocalize. This will translate the required strings at build time and your files will always be localized.

Conclusion

Now you know how to quickly localize your iOS apps. put a star repositoryif you liked it.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *