Forum > Translations

Dutch translated application.messageboxes

(1/1)

masy:
Lazarus doesn't include Dutch translated messageboxes. So You get Dutch boxes with buttons like Yes, No, Cancel ipv Ja, Nee, Annuleren...

To eliminate that create a directory named locale and put in these 2 files:
lcldutch.lrs and lclstrconsts.nl.po

In the mainform add the following units to the interface:
LazFileUtils, IniFiles,
LazUtils, LCLType, LCLTranslator, Translations, LazUTF8, DefaultTranslator;

In the mainform.create add the following:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---const  NLLang = 'nl';  FallBackLang = '';  LCLPOMask = 'lclstrconsts.%s.po';  LCLStrConsts = 'LCLStrConsts';var  PODirectory : string;begin    // You're own code  //  ==========    // Vertaal messageboxen (buttons) naar Nederlands   // ===============================  appdir:=ExtractFilePath(Application.Location);  PODirectory := appdir+'locale\';  TranslateUnitResourceStrings(LCLStrConsts,PODirectory + LCLPOMask, NLLang, FallBackLang);end; // Testing:// =====Button1_click(Sender:TObject);var  appini : string;  BoxStyle,  Reply  : integer;begin     appini:=ExtractFileNameWithoutExt(SaveDialog1.FileName)+'.dat';     BoxStyle := MB_ICONQUESTION + MB_YESNOCANCEL;     Reply := Application.MessageBox(pchar(ExtractFileName(appini)+' bestaat al. Doorgaan?'),'Overschrijven',BoxStyle);      if Reply<> IDYES then      begin        exit;      end;end;
In the programming phase You need to keep this all the way so!!!
In the installation-phase You don't need this any more.
So You don't need to include the 'locale' directory.

HOWEVER (REMARK ;-)):
Within Internationalitation You've got English/American messageboxes with Dutch buttons, like this:
'Delete this file?','Ja, Nee, Annuleren' ipv Yes, No, Cancel...

The world turned around...

Love Lazarus...

How can I add lcldutch.lrs and lclstrconsts.nl.po to this forum-item?



[Edited to add code tags; please read How to use the Forums.]

Bart:
For those dutch speaking users who want to make their lives even easier: the nlautotranslation unit (which requires the po_nl.lrs resource file) is all you need.
Just include it in the uses clause of your main form and all LCL resource strings should be translated automatically.

You can update the po_nl.lrs resource when needed. You can find the "how to" in the comments of the unit.

This unit uses old style Lazarus resources.
I still need to work out how to redesign it to use new style fpc resources though.

Bart

Sieben:

--- Quote from: Bart ---I still need to work out how to redesign it to use new style fpc resources though.
--- End quote ---

Maybe this here might be of any use...?

Bart:
Thanks.

Bart

Navigation

[0] Message Index

Go to full version