Forum > Translations

Translating stuck after first language change when using .mo files

(1/1)

PawelO:
Hello,

I'm trying to write simple application with language selection at runtime, using SetDefaultLang from LCLTranslator. The app has translated form caption, button caption and one resourcestring, + three language selection buttons, EN (default), DE, PL. I have prepared three .po files from .pot file: TestProject.en.po (with no translation - without this switching back to EN doesn't work), TestProject.de.po, TestProject.pl.po, and after editing by poedit I have also three corresponding .mo files.

When I place compiled exe file with .po files in one directory (or with .po files in /languages), it works as intended - I can switch from default to translated languages and back as many times as I want.

But when I use .mo files instead, switching language works properly only once, and then selecting different language does not change form controls captions. Resourcestring is translated, but only when switching between translated languages, when I change back to default language (EN), it is stuck on last translation text. Simple test scenario:

1. Click on DE - everything is in DE (OK)
2. Click on EN - no change at all
3. Click on PL - no change on form, resourcestring is now in PL
4. Click on DE - no change on form, resourcestring is now in DE
5. Click on EN - no change at all

What I'm missing? Shouldn't this work in the same way with .po and .mo files?

CM630:
I do not know if it is related, but maybe you will find this thread useful https://forum.lazarus.freepascal.org/index.php/topic,70407.msg548847.html, some bug in .mo was mentioned.

Navigation

[0] Message Index

Go to full version