@Leledumbo
Yes. I have {$I project.lrs} in initialization section of my main form. I also changed Project Options ... / Miscelaneous "Resource type of project" to *.lrs include files.
There are two big block in *.lrs file: the first begins with "LazarusResources.Add('project.cs','PO',[ " and the second "LazarusResources.Add('project.en','PO',[ ", it also contains correct captions (czech and english) so I think it is correct.
@Bart
Thanks for code, it is compilable but it does not translate.
This snippet from wiki translates well the LCLStrConsts:
PODirectory :='/home/v1/Lazarus_Qt/lazarus/lcl/languages/';
GetLanguageIDs(Lang, FallbackLang);
Translations.TranslateUnitResourceStrings('LCLStrConsts', PODirectory + 'lclstrconsts.%s.po', Lang, FallbackLang);
but I would like to make it work for my own MenuItems etc. I also checked the executable and both czech and english strings are there (that's good!).
OK. I can use the second method with DefaultTranslator and distribute *.po files with executable but - as I mentioned in the very first post - I need to know how to change the language from code (I don't want to use command-line parameter).
Thanks.
EDIT:
If I write this code:
LRes := LazarusResources.Find('project.cs','PO');
writeln(LRes.Name+' '+LRes.Value+' '+LRes.ValueType);
it displays all translated strings correctly (to console) but the form is not translated.