Recent

Author Topic: Translating stuck after first language change when using .mo files  (Read 1116 times)

PawelO

  • New Member
  • *
  • Posts: 27
    • Polish railway traffic and interlocking simulator developed with Lazarus
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

  • Hero Member
  • *****
  • Posts: 1404
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Translating stuck after first language change when using .mo files
« Reply #1 on: March 08, 2025, 10:45:51 pm »
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.
Лазар 4,0 32 bit (sometimes 64 bit); FPC3,2,2

 

TinyPortal © 2005-2018