Recent

Author Topic: change date files to spanish or other idiom  (Read 1751 times)

eldonfsr

  • Sr. Member
  • ****
  • Posts: 295
change date files to spanish or other idiom
« on: February 09, 2022, 05:49:20 am »
Hi there are option to change dates to different language spanish or other by default is english  or can be only if lazarus install select a different language...

02 November 2021  to 01 Noviembre 2021

 

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1175
    • Burdjia
Re: change date files to spanish or other idiom
« Reply #1 on: February 11, 2022, 10:12:33 pm »
That's a good question.  I haven't the answer, but with this message I push the thread up so it may be more visible.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

winni

  • Hero Member
  • *****
  • Posts: 3119
Re: change date files to spanish or other idiom
« Reply #2 on: February 11, 2022, 10:57:01 pm »
Hi!

The month names are delivered from the OS.
So this is OS dependend and make the things complicated.

The easiest way would be to declare a constant array[1..12]  of string with the names of the month:

Code: Pascal  [Select][+][-]
  1. GreekMonth : array[1..12] of string = ('Iανουάριοs','Φεβρουάριοs','Μάρτιοs',
  2. 'Απρίλιοs','Μάιοs','Ιούνιοs','Ιούλιοs','Αύγουστοs','Σεπτέμβριοs','Οκτώβριοs',
  3. 'Νοέμβριοs','Δεκέμβριοs');
  4.  

Winni

wp

  • Hero Member
  • *****
  • Posts: 9902
Re: change date files to spanish or other idiom
« Reply #3 on: February 11, 2022, 11:55:41 pm »
Hi there are option to change dates to different language spanish or other. by default is english.
In Windows the FormatSettings automatically are changed to the language of your OS. In Linux, you must add unit "clocale" to uses. No idea about Mac...

If you want a completely different language, I think you must use the translation system with po files anyway, and you must create resource strings for the month and day names so that they can be translated. Or you must put them into your code as winni showed.

[EDIT]
Just saw now that this post is related to LazReport. It could be that my response is not relevant...

« Last Edit: February 12, 2022, 03:13:55 pm by wp »

JanRoza

  • Hero Member
  • *****
  • Posts: 641
    • http://www.silentwings.nl
Re: change date files to spanish or other idiom
« Reply #4 on: February 12, 2022, 01:27:00 am »
Another solution might be the lazreport OnEnterRect procedure.
Make a text field in your report and fill it programmatically via the OnEnterRect procedure.
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
Laz: Lazarus 2.2.2 FPC 3.2.2
       CodeTyphon 7.9 FPC 3.3.1

eldonfsr

  • Sr. Member
  • ****
  • Posts: 295
Re: change date files to spanish or other idiom
« Reply #5 on: February 12, 2022, 10:12:11 pm »
Yes i do something like that and also for day of week i create a array

    Var  WeekDayNames:Array[0..6] of String;
begin
   WeekDayNames[0]:='Domingo';
   WeekDayNames[1]:='Lunes';
   WeekDayNames[2]:='Martes';
   WeekDayNames[3]:='Miercoles' ;
   WeekDayNames[4]:='Jueves';
   WeekDayNames[5]:='Viernes';
   WeekDayNames[6]:='Sabado';

and on report at getvalue... 

 

TinyPortal © 2005-2018