Some test text!

Search
Hamburger Icon

iOS / Guides / Localization

Localization

The Tools.framework ships with its user-facing strings written in English. This guide explains how you can localize the framework for any language.

Tools localization

Info
This section describes the localization process only if you have integrated the framework using CocoaPods or by embedding the framework binary into your project.

If you are compiling the Tools framework from source (not recommended), follow these instructions to perform localization.

To localize the Tools.framework user-facing strings, all you need to do is add a strings file to the main bundle of your app.

To add a strings file in Xcode, go to File -> New… -> File in the menu bar. From the file templates window, choose Strings File from the Resource section and click Next. This new file must be named PTLocalizable.strings in order for the Tools framework to correctly identify the appropriate file to use for localization.

Adding a strings file

PTLocalizable.strings

Localizing your app

Localization can be added to your app by following these steps:

  1. Select your project from the Project navigator.

  2. Select your project from the dropdown or list of projects and targets.

  3. Add a new localization by clicking on the plus sign below 'Localizations'.

Localization in Xcode

Once your app is configured for localization, clicking 'Localize…' in Xcode's file inspector for PTLocalizable.strings will allow you to localize the file.

Localizing an existing file

Localizable strings

To see which strings in the Tools framework can be localized, see the included Localizable.strings reference files. The location of these files depends on how the framework was integrated into your app:

IntegrationPathLocation
CocoaPods Pods/PDFNet/Resources/Tools-Localization/<language-code>.lprojXcode
Manual Lib/Tools/src/PDFViewCtrlTools/Tools/<language-code>.lprojDownloaded package

These files contain the key-value pairs which are used to define the user-facing strings in Tools and are for reference only — modifying them has no effect. You can add any of the keys to your PTLocalizable.strings file and define a custom value to display to the user.

Localization when compiling Tools from source (deprecated)

Warning
This method only applies to versions of the SDK prior to v6.10.2.

This method is not recommended as it involves editing the Tools.framework strings file directly which will create a requirement to manually merge strings files when updating to new versions of Tools.framework.

If you are manually compiling the Tools.framework from source, localization can be performed by following these steps:

  1. Select the Tools project from the Project navigator.

  2. Select the Tools project from the dropdown or list of projects and targets.

  3. Add a new localization by clicking on the plus sign below 'Localizations'.

    Adding a new localization

  4. Check the box next to the file for the new localization (the Localizable.strings file) and click 'Finish'.

    Select the files for the new localization

A new Localizable.strings file will be created in /Lib/Tools/src/PDFViewCtrlTools/Tools/<language-code>.lproj with the contents of the reference language (English by default). You can then enter a translation on the right-hand side of each entry in the .strings file.

Get the answers you need: Chat with us