Recent

Author Topic: How can I change the language messagedlg buttons?  (Read 307 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 713
How can I change the language messagedlg buttons?
« on: October 08, 2024, 07:24:56 pm »
Hi,
How can I give the buttons of a messagedlg the correct language? As far as I can find, this cannot be set with the i18n option. (With the instruction:
Quote
https://wiki.lazarus.freepascal.org/Step-by-step_instructions_for_creating_multi-language_applications
)

Concerns Windows 11. I have set everything to Dutch in Windows, but the messagedlg buttons remain in English in my tool.

I would actually like to be able to manually set the language of the messagedlg buttons. So if I choose a different language in my tool, the buttons follow  and are not dependent on the OS settings.


wp

  • Hero Member
  • *****
  • Posts: 12405
Re: How can I change the language messagedlg buttons?
« Reply #1 on: October 08, 2024, 07:49:41 pm »
Copy the file lclstrconsts.nl.po from the lcl/languages folder of the Lazarus installation into your project output folder. Then, very early, e.g. in the initialization section of the main form, call "TranslateUnitResourceStrings('lclstrconsts', PODir + 'lclstrconsts.nl.po')" where PODir is the directory with lclstrconsts.nl.po.

See attached demo. It works fine with the LCL dialogs. The dialogs completely created by the widgetset, however, partially ontain texts in the language set by the OS (German in my case). But when your Windows is set up for Dutch, then this should be just fine.

Sieben

  • Sr. Member
  • ****
  • Posts: 349
Re: How can I change the language messagedlg buttons?
« Reply #2 on: October 08, 2024, 09:53:05 pm »
You might also want to have a look at this one - all you would need to do (provided your Windows is set up for Dutch) is import lclstrconsts.nl.po into the resources of your project and include rkDefTrans in the uses clause of your project source file (*.lpr). Don't forget to compile (not install) package restrans.lpk once in order to let the IDE know where the files can be found and to add package ResTrans to your project's requirements.
« Last Edit: October 08, 2024, 10:42:20 pm by Sieben »
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

Bart

  • Hero Member
  • *****
  • Posts: 5442
    • Bart en Mariska's Webstek
Re: How can I change the language messagedlg buttons?
« Reply #3 on: October 08, 2024, 10:24:24 pm »
For Dutch language you can also just download nlautotranslation.pp and nlautotranslation.res and have the nlautotranslation in the uses clause of the main form.

(All this based upon Siebens work of course.)

Bart

Hansvb

  • Hero Member
  • *****
  • Posts: 713
Re: How can I change the language messagedlg buttons?
« Reply #4 on: October 09, 2024, 06:33:32 am »
Hi,

I'll take a look at the proposals. I want to fit it into the MVP model.
Quote
https://forum.lazarus.freepascal.org/index.php/topic,65825.0.html
All regular captions, hints etc fit in very nicely, just the standard buttons of dlg boxes don't yet.

 

TinyPortal © 2005-2018