Recent

Author Topic: Looking for Translation i18n components  (Read 869 times)

Saylo_49

  • New Member
  • *
  • Posts: 43
Looking for Translation i18n components
« on: May 20, 2019, 01:34:27 am »
Hello

I am looking if there is a component or a package or a method or anything else that provide the i18n feature for lazarus project

I am looking for something that is
- cross-platform
- relying on external files (xml, dll, dylib, so, ..) like the Po feature
- work like the GetText (it catch all the text and caption properties in the code without the need of writing them out in a Pascal unit
- and support all components (Comboboxes, SpkToolbar, ...)

I have seen and used the Po but it lacked the getting of captions in the SpkToolbar component
« Last Edit: May 20, 2019, 01:36:37 am by Saylo_49 »
Lazarus 2.0.2 - FPC 3.0.4 - Win32

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: Looking for Translation i18n components
« Reply #1 on: May 20, 2019, 03:39:38 am »
That's because that component does not have TTranslation types in use..
 its the component at fault not the PO support.
The only true wisdom is knowing you know nothing

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: Looking for Translation i18n components
« Reply #2 on: May 20, 2019, 11:49:18 am »
If I understand you correctly, maybe you need to use i18n in combination with the resourcestring.
Code: Pascal  [Select][+][-]
  1. uses
  2.   ... LCLTranslator;
  3.  
  4. resourcestring
  5.   SpkTab1Cap = 'Language';
  6.   SpkPane1Cap = 'UI language';
  7.   SpkRadioButton1Cap = 'English';
  8.   SpkRadioButton2Cap = 'Japanese';
  9. ...
  10. procedure TForm1.ChangeUILang(const ATag: Integer);
  11. begin
  12.   case ATag of
  13.     1: SetDefaultLang('en','lang');
  14.     2: SetDefaultLang('ja','lang');
  15.   end;
  16.  
  17.   ApplySettings(Self);
  18. end;
  19.  
  20. procedure TForm1.ApplySettings(Sender: TObject);
  21. begin
  22.   SpkTab1.Caption:= SpkTab1Cap;
  23.   SpkPane1.Caption:= SpkPane1Cap;
  24.   SpkRadioButton1.Caption:= SpkRadioButton1Cap;
  25.   SpkRadioButton2.Caption:= SpkRadioButton2Cap;
  26. end;
  27.  
  28. procedure TForm1.FormCreate(Sender: TObject);
  29. begin
  30.   ChangeUILang(SpkRadioButton1.Tag);
  31. end;
  32.  
  33. procedure TForm1.SpkRadioButton1Click(Sender: TObject);
  34. begin
  35.   ChangeUILang(SpkRadioButton1.Tag);
  36. end;
  37.  
  38. procedure TForm1.SpkRadioButton2Click(Sender: TObject);
  39. begin
  40.   ChangeUILang(SpkRadioButton2.Tag);
  41. end;  
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

 

TinyPortal © 2005-2018