Soluling home   Document home


How to Localize Delphi FireMonkey Applications

This tutorial shows how to localize your Delphi FireMonkey application using Soluling.

Note! If you target only to Windows and macOS we recommend using the binary localization method.

Steps you need to do before your can localize

Before you can start localizing your VCL application, you need to perform the following step:

Once you have done the above step, you can create a Soluling project file.

Create a project

Start Soluling. Click New from File or Files button in the main view or drag and drop your Delphi project file (.dproj) on the main view. Soluling start the Project Wizard that collects the information needed to create a new Soluling project. The first sheet of the wizard is the Options sheet.

Delphi options sheet of Project Wizard

Click Next. The Select Languages sheet appears.

Delphi options sheet of Project Wizard

Add the languages you want to localize. Later you can add new languages at any time. Set the original language of your original language. Click Finish to complete the wizard.

Delphi options sheet of Project Wizard

Now your project is created, and you can start translating it.

Translate the project

Follow the general translate instructions to translate your project. When you have translated the project, you can build the localized files.

Build the resource file and add it to into your project

When you build the project, the output file is a single multilingual resource file (NtLangRes.ntres) that contains the form, strings, and other resources in the languages you have in the Soluling project file. You have two choices to use the translation file in your application.

Option 1 - Embedd the resource file into the application file

Add the NtLangRes.ntres resource file as a custom RCDATA resource into your Delphi project. Choose Project | Resource, and Images from Delphi.

Make sure the resource identifier is NtLangRes. Add the NtResource unit, call _T function for each form, and compile your project. Now it is multilingual and enabled for the runtime language change. FireMonkey localization can also be used in VCL projects.

Option 2 - Deploy the resource file as a standalone file

Another choice is to use the resource file as a standalone file. Typically you first either deploy or download the file to a directory. Then, in your application code, set the NtResources.ResourcePath property. This must be set before any form gets created. A good place is the initialization section of the main form.

  NtResources.ResourcePath := '/Documents/Donwloaded/NtLangRes.ntres';

Note! All the platforms (iOS, Android, etc.) of Delphi use the same .ntres file, but the file paths are very platform-specific, so you most likely need to use conditional compiling.

If you don't specify the ResourcePath, Soluling code will try to find the file from directory returned by TPath.GetDocumentsPath (Delphi's RTL code). The directory is platform specific:

OS Directories Notes

The same directory as the application EXE

If you application is C:\Files\Project1.exe then Soluling code first looks for C:\Files\NtLangRes.ntres.
If not found then looks for Documents/Project1​/NtLangRes.ntres
If the project specific document directory does not exist then looks for Documents/NtLangRes.ntres
macOS /Users/<user>/Documents​/<applicationname>
Android /data/data/com.embacadero.<​applicationname>/files  

<applicationname> is the filename of your application without the extension

In addition to the multilingual resource file (.ntres), Soluling can also create language-specific resource files (.ntlang). You can deploy these files instead of the .ntres file. This makes it possible to add new languages without changing any installed file. To make Soluling create .ntlang files, check either Languages specific resource files or Both in Output file type group box in the Delphi build options sheet.

Delphi build options

If you set the ResourcePath property, set only the directory part. for example.

  NtResources.ResourcePath := '/Documents/Donwloaded';

Soluling code then tries to find all .ntlang file in that directoru and uses them.