Recent

Author Topic: [solved] Problem of translation  (Read 13629 times)

gillou58

  • New member
  • *
  • Posts: 9
[solved] Problem of translation
« on: February 07, 2015, 04:07:14 pm »
As a French programer  - and a newbie with Lazarus after a long time using Delphi- i'd like to work with Lazarus without thinking of tranlation problems.
As soon as I begin to work with lazarus, I get a serious problem :
1. put a TBitBtn on a form, change its kind to bkClose and look : I get a French caption...
2. run the program : the caption turns to English caption...  :o
3. change manually the original caption and everything get right.
Could someone explain this to me ?
Thanks a lot,
Gilles


NB :because it was full of mistakes, i've rewritten 90% of "lclstrconsts.fr.po" : where might i put this new file to be used by the French communauty ?
« Last Edit: February 08, 2015, 06:13:51 pm by gillou58 »

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Problem of translation
« Reply #1 on: February 07, 2015, 04:36:50 pm »
NB :because it was full of mistakes, i've rewritten 90% of "lclstrconsts.fr.po" : where might i put this new file to be used by the French communauty ?

Attach the file on a new ticket in the Lazarus (not FPC) bugtracker (see the panel to the left of the forum messages which lists various links). Then one of the developers will get to see it. If it's accepted it will then be used to update Lazarus in future.

paweld

  • Hero Member
  • *****
  • Posts: 970
Best regards / Pozdrawiam
paweld

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Problem of translation
« Reply #3 on: February 07, 2015, 10:56:08 pm »
...
NB :because it was full of mistakes, i've rewritten 90% of "lclstrconsts.fr.po" : where might i put this new file to be used by the French communauty ?

The corresponding file is certainly not perfect (it mainly misses the new entries since the last translation), but 90% is, well, a bit "frightening".

For instance, your sample is already covered (and with a correct translation) :
Code: [Select]
#: lclstrconsts.rsmbclose
msgid "&Close"
msgstr "&Fermer"

So, what do you mean exactly with "90%" ?

Welcome in this community.
« Last Edit: February 07, 2015, 10:59:06 pm by ChrisF »

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Problem of translation
« Reply #4 on: February 08, 2015, 01:35:15 am »
Attach the file on a new ticket in the Lazarus (not FPC) bugtracker (see the panel to the left of the forum messages which lists various links). Then one of the developers will get to see it. If it's accepted it will then be used to update Lazarus in future.

Please use the pochecker tool on the file before submitting it.
It will not be accepted if the pochecker tool shows any error.
(Errors in po-files can potentially lead to program crashes.)

The pochecker tool can be run from IDE (if the pochecker package has been installed), or you can build the tool as a stand-alone executable from ($lazarusdir)/components/pochecker/Proj.

Post the entire po-file, not a diff.

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Problem of translation
« Reply #5 on: February 08, 2015, 01:37:47 am »
Could someone explain this to me ?

The IDE uses the Translations unit (and the po-files) to do the translation.
Your program should do the same.

The link that paweld gave you shows you how to do that.

Bart

gillou58

  • New member
  • *
  • Posts: 9
Re: Problem of translation
« Reply #6 on: February 08, 2015, 10:41:51 am »
Quote
The corresponding file is certainly not perfect (it mainly misses the new entries since the last translation), but 90% is, well, a bit "frightening".
So, what do you mean exactly with "90%" ?

Oups, sorry ! I've done 90% of the job... Sorry for my approximate English...  But a lot of old items are written in bad French, specially concerning spelling. Otherwise, colors are not translated, meaning that components as TColorBox can't use pretty captions, and so on. That's more than 150 items that needed to be corrected. That's why i do this job... if somebody thinks it's useful.

Quote
For instance, your sample is already covered (and with a correct translation) :
Code: [Select]
#: lclstrconsts.rsmbclose
msgid "&Close"
msgstr "&Fermer"

So, if it's covered, why doesn't it work with a fresh installation of Lazarus ? (see attached screen of my first post)
Best regards,
Gilles
« Last Edit: February 08, 2015, 10:48:00 am by gillou58 »

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Problem of translation
« Reply #7 on: February 08, 2015, 01:00:30 pm »
Just a note: make sure that the po-file itself is stored with UTF-8 encoding.
(If you edit in Lazarus IDE this is the default setting, editing it in Notepad may however change the encoding.)

Bart

gillou58

  • New member
  • *
  • Posts: 9
Re: Problem of translation
« Reply #8 on: February 08, 2015, 01:17:16 pm »
Just a note: make sure that the po-file itself is stored with UTF-8 encoding.
(If you edit in Lazarus IDE this is the default setting, editing it in Notepad may however change the encoding.)

Bart

po-file is stored with UTF-8 encoding (verified with NotePad++)...

I try to explain my problem in an other way...
1. I install a fresh Lazarus to work with my language : French.
2. I create a new program.
3. I put a TBitButton on the form.
4. I turn the Kind property to bkClose : the form shows the new caption in French language as wanted.
5. I run the program : the button shows an English caption...
6. I change the caption of the button : everything is OK.
As far as a caption for a single button is concerned, this is just a little boring to make sure captions will agree with the wanted language, but when you use a TColorBox with pretty captions...

Quote
The IDE uses the Translations unit (and the po-files) to do the translation.
Your program should do the same.

The link that paweld gave you shows you how to do that.

I don't exactly understand what the link means  : when i write a trivial program,  like the one proposed above, do I have to consider po-files ? This sounds quite strange...
Sorry for the work and thanks a lot for people answering,
Gilles




« Last Edit: February 08, 2015, 02:59:41 pm by gillou58 »

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Problem of translation
« Reply #9 on: February 08, 2015, 03:03:09 pm »
So, if it's covered, why doesn't it work with a fresh installation of Lazarus ? (see attached screen of my first post)

As explained by Bart, the Lazarus IDE is doing the job for the LCL translation (that's why you see 'Fermer' in the IDE), while your own program doesn't (so, 'Close' is displayed here).

As Bart has written, you must do the conversion using .po files.

Here is, for instance, one topic in the forum concerning translations:
http://forum.lazarus.freepascal.org/index.php?topic=13388.0

And attached, a basic sample for the LCL translation, using a bkClose BitBtn.

Modify the path to you own Lazarus path in TestLCLTrans.lpr (it's hard coded in this sample).

Most interesting part:
Code: [Select]
program TestLCLTrans;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, Unit1
  { you can add units after this },
  GetText, Translations;

{$R *.res}

procedure TranslateLCL;
const LAZARUS_PATH = 'c:\lazarus';
var Lang, DefLang: String;
begin
  GetLanguageIDs(Lang, DefLang);
  TranslateUnitResourceStrings('LCLStrConsts',
      LAZARUS_PATH+'\lcl\languages\lclstrconsts.%s.po', Lang, DefLang);
end;

begin
  RequireDerivedFormResource := True;
  TranslateLCL;
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
« Last Edit: February 08, 2015, 03:09:56 pm by ChrisF »

gillou58

  • New member
  • *
  • Posts: 9
Re: Problem of translation
« Reply #10 on: February 08, 2015, 05:58:11 pm »
Great ! I'll try as soon as i can. Thanks a lot.

gillou58

  • New member
  • *
  • Posts: 9
Re: Problem of translation
« Reply #11 on: February 08, 2015, 06:12:50 pm »
Everything 's OK ! I now understand the principle (far from my habits with Delphi !).
I promiss i'll keep on translating the other partially tranlated files. :) My new own lclstrconsts.po works pretty well.
Thanks to everybody.
Gilles


Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Problem of translation
« Reply #12 on: February 08, 2015, 06:17:14 pm »
My new own lclstrconsts.po works pretty well.

lease post it in the bugtracker so other French people can profit from your work.

Bart

gillou58

  • New member
  • *
  • Posts: 9
Re: Problem of translation
« Reply #13 on: February 08, 2015, 06:44:49 pm »
My new own lclstrconsts.po works pretty well.

lease post it in the bugtracker so other French people can profit from your work.

Bart

Done.  O:-)

 

TinyPortal © 2005-2018