Recent

Author Topic: TvPlanit - language gulps  (Read 2327 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1002
TvPlanit - language gulps
« on: July 18, 2022, 01:28:45 pm »
I took the very latest version of tvPlanit today (r8351).

Not sure, if this problem is a bug or just my mess:
The language is a mix of German and English.

Without doing anything in languages, the component writes "18. Juli" (much appreciated!).

But unfortunately "Week of Montag" (see screenshot).
Anywhere I read something like "Woche mit Montag" which does not make sense in German.

and: please give me a comma, not a point past 18.
not 18, Juli, but 18. Juli

Case it is my fault: Pls hint me, where to key in the language.

Case it is a bug, this is my feedback for German putting:

The most easiest way would be to write
Montag, 18. Juli, 2022 (29. Woche)
or
29. Woche, 18. Juli 2022
or
Mo, 18.7.22 (29. KW) 

where KW is short for Kalenderwoche or even only W just "week".

(And another hint:
At least until the update before, there was a date-bug in Win 10.
If you did certain display settings in the German windows, it made in TMS the date of Zero.
This was NOT the fault of TMS, Bruno looked very carefully at it. It was the fault of the Windows 10's interface.
So, case you once have a very strange case, where the date suddenly causes a strange thing with being "Zero", send me a message to provide the details from my fundus. Not sure, if it is in the last Win 10 update still)


wp

  • Hero Member
  • *****
  • Posts: 12294
Re: TvPlanit - language gulps
« Reply #1 on: July 18, 2022, 06:13:27 pm »
A Lazarus application prepares the DefaultFormatSettings for your system language, in your case German. The strings used by the LCL and third-party libraries, however, are in English. And therefore, you get that mix of German and English.

If you write your application with English texts (because you want to publish it in the forum) your simplest solution is to convert the FormatSettings to English.

If you write your application with German texts you must activate the i18n translation system of Lazarus. To get started you could read:
- https://wiki.lazarus.freepascal.org/Step-by-step_instructions_for_creating_multi-language_applications
- https://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs

The basic steps are (assuming that you write a simple application in German and use only LCL and TvPlanIt):
  • Activate the i18n option in the project settings
  • Specify a folder for the translation files; this is usally a subfolder of your application directory, named "translations" or "languages" or "locale".
  • Copy the file vpsr.de.po from the TvPlanIt translations folder and the file lclstrconsts.de.po from the Lazarus lcl/translations folder to this directory. The ".de" identifies the German translation.
  • Add units "Translations" and "LCLTranslator" to the uses clause of your main form.
  • Add code to translate the TvPlanIt strings to German (TranslateUnitResourceStrings from unit Translations); the translation of the LCL strings has been done by the LCLTranslator already.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. var
  3.   translationsDir: string;
  4. begin
  5.   translationsDir := ExpandFileName(Application.Location + '../../languages/');
  6.   SetDefaultLang('de', translationsDir);
  7.   Translations.TranslateUnitResourceStrings('vpsr', translationsDir + 'vpsr.de.po');
  8.   ...
« Last Edit: July 24, 2022, 01:34:24 pm by wp »

wp

  • Hero Member
  • *****
  • Posts: 12294
Re: TvPlanit - language gulps
« Reply #2 on: July 24, 2022, 01:43:37 pm »
Assuming that you never intend to translate your application to another language, and provided that you use only German strings, the steps to create a German-only application can be simplified:
  • Copy the German translation file vpsr.de.po from the TvPlanIt installation into your project folder (or a subfolder of it).
  • Repeat the same with the LCL translation file lclstrconsts.de.po from lcl/languages of your Lazarus installation.
  • Add unit "Translations" to the uses clause of your main form.
  • In the OnCreate handler of the main form write the following code which translates the TvPlanIt and LCL strings to German:
Code: Pascal  [Select][+][-]
  1. procedure TMainForm.FormCreate(Sender: TObject);
  2. var
  3.   langDir: String;
  4. begin
  5.   langDir := Application.Location;  // or extend by the name of the subdir in which your stored the po files.
  6.   TranslateUnitResourceStrings('vpsr', langdir + 'vpsr.de.po');
  7.   TranslateUnitResourceStrings('lclstrconsts', langdir + 'lclstrconsts.de.po');
  8. end;

To non-German users: Of course, the same procedure can be applied to any language; just replace the "de" by the your language code (e.g. "fr" for French) and copy the corresponding files.

 

TinyPortal © 2005-2018