View Issue Details

IDProjectCategoryView StatusLast Update
0025376LazarusOtherpublic2014-10-22 01:00
ReporterMike SapsardAssigned ToMaxim Ganetsky 
Status closedResolutionfixed 
Product Version1.2.0RC1Product Build 
Target VersionFixed in Version1.2.0 
Summary0025376: Translations example
DescriptionA small example project calld i18n-test showing how to use defaulttranslator unit. Hopefully to be included in version 1.2. Suggest folder examples/translations. Created with help from WP.
Steps To ReproduceRun attached project, which shows how to make translations work on two forms.
TagsNo tags attached.
Fixed in Revision43571, 43573
Attached Files


has duplicate 0025380 closedMaxim Ganetsky Example project for creating multi-language application 



2013-11-27 00:33

developer   ~0071632

Oh - Mike was faster than me...

I just attached another sample project for localization. It is based on the image viewer example and is described by step-by-step instructions in the tutorial that I just uploaded to the wiki (

Maxim Ganetsky

2013-11-27 22:39

developer   ~0071657

i18-test crashes for me when I try to change language in combobox after opening second form.

imgviewer_multilang has the following problems:

1. Its unit output directory should be "units\$(TargetCPU)-$(TargetOS)", not "bin".
2. After compilation binary is located in unit output directory and thus cannot load translations (it appears as not working when compiled and run with F9).
3. I don't like that you supply a copy of lclstrconsts.*.po, it is unnecessary bloat. IMO mentioning that it could be put there would be enough. Also *.mo files are not needed.
4. This example doesn't seem to be very intuitive without your Wiki description, maybe it's better to preload images or something.

Also please note that we already have "codepageconverter" example which uses DefaultTranslator too. Maybe it's better to extend it to avoid duplication.


2013-11-28 00:27

developer   ~0071661

I had re-posted the demo project as issue 0025380 today because I was not sure if it would receive attention as an apprendix here. Sorry, if that had caused confusion...

(1) Correct
(2) The demo of 0025380 uses the source folder as output directory, and translation works with F9.
(3) Agreed
(4) This argument is true for many example projects. I can add a readme file for further explanation - the original imgviewer has one as well, and this is great.

I had a look at the "codepageconverter", but I got the impression that it is not so well-suited as a project for a beginner's tutorial. It is too much of an internal tool, beginners won't see what the program is good for. The purpose of the image viewer, on the other hand, is clear from the beginning. Since the non-translated version is available in the examples folder, I though it would be a good starting point to demonstrate the work-flow of translation ending at the submitted version.

Considering your points (1)-(4) I am attaching a modified version of the project.

Mike Sapsard

2013-11-28 10:03

reporter   ~0071671

I'll check i18n-test and resubmit with fixes. (It does not need DefaultTranslator in lpr uses clause, and requires 1.2RC1)

Mike Sapsard

2013-11-28 22:57

reporter   ~0071691

I have fixed i18n-test, and uploaded it. It was not a defaulttranslator problem.

Maxim Ganetsky

2013-11-29 00:05

developer   ~0071692

Can you both merge your examples? I don't think we need two. Otherwise I will have to select one of them.


2013-11-29 13:20

developer   ~0071697

I think for merging the examples are too different. But I'd agree if you drop mine: the i18n-test contains only code related to translation while in my example the translation code is buried underneath the image viewer code. And the steps described in the wiki tutorial are so simple that it is not absolutely necessary to have the final project available for testing and comparison.

@Mike: some comments on your example:
- the variable "defaultlang" is not needed.
- the code in Combobox1Select after SetDefaultLang is not needed either. It is the beauty of DefaultTranslator that the translation of UI controls is done automatically (with a few exceptions). Accordingly, there is no need to specify an explicit resourcestring for the caption of Button1 - in fact, this is the reason why the current version does not translate the button caption after you drop the unnecessary code from Combobox1Select.
- I upload a modified version - see my comments marked as "wp". This demo also translates the language selection combobox items - because this is a case not handled automatically by DefaultTranslator.

Mike Sapsard

2013-12-01 21:03

reporter   ~0071721

Thanks wp. I'm happy to go with it. In my original example, Form2 was created dynamically and I put in an explicit resource string section for Form2(perhaps incorrectly) to try and minimise memory usage. Itjust happened that it was the same as the caption for Form1 but with a different number.

Mike Sapsard

2013-12-02 16:14

reporter   ~0071727


I have looked through more closely. I think we need to show clearly:

1) How to use the format statement to handle complex captions/labels.
2) How to work across forms.
3) Some of the items that are not automatically translatable. Is there a list of a few?

I will go through and clean it up, then repost it for you to go through.


2013-12-02 22:58

developer   ~0071738

Mike, maybe we should not spoil the bug tracker with this discussion and should only come back here with an agreed solution. I'll send you a PN.


2013-12-19 23:51

developer (144,372 bytes)


2013-12-20 00:00

developer   ~0071979

Just uploaded a new translation example project by Mike and myself. Please delete the other two projects.

It covers several issues discussed in the forum (,22881.0.html) and can serve as a master for translation projects, and we consider it important to have something like that in the examples folder of Lazarus.

The French, Spanish and Hebrew translations of this demo were obtained by google-translate. Native speakers, therefore, should excuse us for strange formulations or mistakes...

I should mention that the demo contains a workaround for BiDi bugs of TRadioGroup and TCheckGroup. Once my patch in 0025408 has been applied this can be removed.

Maxim Ganetsky

2013-12-20 21:57

developer   ~0071988

Applied to trunk and merged to 1.2, thanks.

Changes to your program:

1. Removed icon to save some HDD space.
2. Added Russian translation.


2013-12-20 22:13

developer   ~0071990

Thanks for the Russian translation

Issue History

Date Modified Username Field Change
2013-11-26 20:26 Mike Sapsard New Issue
2013-11-26 20:26 Mike Sapsard File Added: i18n-test.7z
2013-11-26 20:44 Maxim Ganetsky Assigned To => Maxim Ganetsky
2013-11-26 20:44 Maxim Ganetsky Status new => assigned
2013-11-27 00:31 wp File Added:
2013-11-27 00:33 wp Note Added: 0071632
2013-11-27 16:21 Juha Manninen Relationship added related to 0025380
2013-11-27 20:26 Maxim Ganetsky Relationship replaced has duplicate 0025380
2013-11-27 22:39 Maxim Ganetsky LazTarget => -
2013-11-27 22:39 Maxim Ganetsky Note Added: 0071657
2013-11-27 22:39 Maxim Ganetsky Status assigned => feedback
2013-11-28 00:27 wp Note Added: 0071661
2013-11-28 00:29 wp File Added:
2013-11-28 01:34 Maxim Ganetsky Status feedback => assigned
2013-11-28 01:35 Maxim Ganetsky File Deleted:
2013-11-28 10:03 Mike Sapsard Note Added: 0071671
2013-11-28 22:57 Mike Sapsard Note Added: 0071691
2013-11-28 23:00 Mike Sapsard File Added: i18n-test_fixed.7z
2013-11-29 00:05 Maxim Ganetsky Note Added: 0071692
2013-11-29 00:05 Maxim Ganetsky Status assigned => feedback
2013-11-29 00:05 Maxim Ganetsky File Deleted: i18n-test.7z
2013-11-29 13:20 wp Note Added: 0071697
2013-11-29 13:20 wp File Added:
2013-12-01 21:03 Mike Sapsard Note Added: 0071721
2013-12-01 21:03 Mike Sapsard Status feedback => assigned
2013-12-01 23:36 Maxim Ganetsky File Deleted: i18n-test_fixed.7z
2013-12-02 16:14 Mike Sapsard Note Added: 0071727
2013-12-02 22:58 wp Note Added: 0071738
2013-12-19 23:51 wp File Added:
2013-12-20 00:00 wp Note Added: 0071979
2013-12-20 20:21 Maxim Ganetsky File Deleted:
2013-12-20 20:21 Maxim Ganetsky File Deleted:
2013-12-20 21:57 Maxim Ganetsky Fixed in Revision => 43571, 43573
2013-12-20 21:57 Maxim Ganetsky Widgetset Win32/Win64 =>
2013-12-20 21:57 Maxim Ganetsky Note Added: 0071988
2013-12-20 21:57 Maxim Ganetsky Status assigned => resolved
2013-12-20 21:57 Maxim Ganetsky Fixed in Version => 1.2.0
2013-12-20 21:57 Maxim Ganetsky Resolution open => fixed
2013-12-20 22:13 wp Note Added: 0071990
2014-10-22 01:00 wp Status resolved => closed