Delphi - TLanguage localizaton tool

There are many translation tools around for Delphi: they can be free or not and of course each one has pros and cons. I have decided to write my localization tool called TLanguages which is a component that is compatible with VCL and FMX!

This component is very easy to use and it is useful in small projects where you have some strings to localize. I have written this for myself where I don't need a lot of lines of text to be localized but I want to share it with you in case you'll ever need it. The usage is pretty easy:

  1. Open the Editior. If you already have a file, then just open it! Otherwise, write in the box the path in which you want the new file to be created.

  2.  Now add some words. The Default language cannot be deleted and it will be used (surprise) as default language.
  3. Click Save Edits and open the Delphi IDE. Create a new project (just as test) and the click Project -> Resources and Images -> Add... -> load the json file containing the translations. Give it an unique resource identifier (URI) and keep it in mind!
  4. Create the class TLanguage and pass in the constructor the URI you have written above. Now if you want to localize a word, just call the localize method and it will return the translated string!

The arguments that you have to pass to the localize function are: the language id and the word. Look at this example:
If you call localize('italian', 'test') the result will be 'prova'. Pretty easy to use!

 The zip file doesn't contain a virus that destroys your computer. Instead, it contains the delphi package (the TLanguage component) and the editor which allows you to manage the languages. 

I plan to improve it, maybe adding the possibility to change the language at runtime. I would also like to be able to localize automatically components like buttons and labels but that's a step that I'm going to (probably) do in the future ;)

Install the package

You need to open the package called ProjectLanguages.dpk, then on the top-right part of the IDE (Project Manager) right click on Build and finally click Install. Then you have to go into Tools -> Options -> Delphi ->Library Path and add the path to the source file called TLanguage.


  1. Nice Idea. Maybe you want to look into Delphinus (Packagemanager for Delphi) to distribute your package and allow simpler installation :)


Post a Comment

Popular posts from this blog

Delphi - Linux load apache module

Delphi - Android full screen splash