Foxit PDF SDK for iOS

How to change Localization settings with Foxit PDF SDK for iOS

Foxit PDF SDK for iOS Localization Feature

Foxit PDF SDK for iOS now allows users to customize the UIExtensions project language by themselves through localization files. In this article, we will show you how to achieve that functionality. Currently, our SDK comes with English, Chinese and Korean language files by default. Please follow the steps below to add your own localization settings to the UIExtension for your application.

Creating your own localization file in UIExtensions project

  • Open the UIExtension project in Foxit PDF SDK for iOS directory ‘libs\uiextensions_src\uiextensions.xcodeproj’

Figure 1-1

  • Select the “uiextensions project under ‘PROJECT’ and click on the “Info” tab as below:

Figure 1-2

  • Under “Localizations” press the “+” sign and select the language you wish to have supported. In this tutorial, we will create a Spanish language localization file.

Figure 1-3

Figure 1-3-1

  • The localized file will be generated to libs\uiextensions_src\UIExtensions\Resource\FoxitLocalizable\(abbreviated-language).lproj

Figure 1-4

  • Locate the file and change the value of each string on the right to the language you wish to support. For example, the line says ‘”KSuccess” = “Success”‘ will be translated into “kSuccess” = “Éxito” as seen below.

Figure 1-5

Note: Using translator services online and copying+pasting content may lead to incorrect characters and syntax on your .strings file. Please be careful when moving the strings across for special characters (‘/n’,’%’,”/Save/”) that might cause your application strings to be incorrectly formatted or even not able to build the project.

  • Build the UIExtension project

If the build is successful, that means your UIExtensions project now has a Spanish language localization file. The next section will show how to add that into the sample project Foxit PDF SDK offers and see the new language in action.

Implement localization file on Foxit PDF SDK for iOS Sample Project

Now that the UIExtensions library has been updated with the language file you wish to use, you will run the sample ‘complete_pdf_viewer‘ demo and see the change effects into a real-time mobile PDF viewer. Follow the steps below:

  • Open the ‘complete_pdf_viewer‘ project inside your Foxit PDF SDK for iOS folder

Figure 2-1

  • Make sure that the uiextensionDynamic.framework is linked under your app project “Embedded Binaries” correctly. If not, please update your project accordingly with the new uiextensionDynamic.framework. Embedded Binaries are located under your project file as below:

Figure 2-2

  • In your Application project in Xcode go to “Project Navigator”, select ‘complete_pdf_viewer‘ listed under “PROJECT” and click on the “Info” tab

Figure 2-3

  • Under “Localizations” press the “+” sign and select the language you wish to have supported

Figure 2-4

  • For the reference files, just select the FoxitLocalizable.strings file. Uncheck the rest. Click Finish to create the file.

Figure 2-5

  • If you get a message that says “FoxitLocalizable.strings” couldn’t be copied to “xx.lproj” because an item with the same name already exists, go to where the file exists. Copy that file to a temporary location. Repeat previous steps. Note: This step is to correctly reference the file.

Figure 2-6

  • Copy the libs\uiextensions_src\UIExtensions\Resource\FoxitLocalizable\xx.lproj to the location where xx.lproj project was created. This copy is to make sure that the xx.lproj has the same localization content.
  • Go to your iOS device settings and change the device language to the language you chose to localize.

Figure 2-7

  • Build and push your application to the device. You will be able to see the language of the application is now displayed in Spanish.

Figure 2-7-1

Figure 2-7-2

Figure 2-7-3

For additional information on localization on iOS devices, please refer to the Apple Developer Guide here.

Updated on July 21, 2021

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: