How does Free Pascal set DefaultFormatSettings under Linux lazarus / 32-Linux ---------------------------------------------------------------------- Gustavo 'Gus' Carreno · 2025-06-28 17:04 Hey Y'all, I'm starting a new thread, cuz nobody ever solved this for @wp here: https://forum.lazarus.freepascal.org/index.php/topic,19898.0.html I'm now under the same-ish condition... I've been able to translate the humanize package even when we provide a command line of -l|--lang. The next logical step would be to then change the DefaultFormatSettings for the language we obtain with this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function GetLanguageFromCommandLine: String;var  index: Integer;begin  Result:= EmptyStr;  for index:= 0 to ParamCount do  begin    if ParamStr(index) = '-l' then    begin      Result:= ParamStr(index + 1);      break;  end;    if Pos('--lang', ParamStr(index)) > 0 then    begin      if Pos('=', ParamStr(index)) > 0 then      begin        Result:= Copy(ParamStr(index), Pos('=', ParamStr(index)) + 1, Length(ParamStr(index)));        break;      end      else      begin        Result:= ParamStr(index + 1);        break;      end;    end;  end;  if Result = EmptyStr then    Result:= GetLanguageID.LanguageCode;end; From the thread mentioned above, there is a solution to do that under Windows with GetLocaleFormatSettings. Upon this information, one would ask: Is DefaultFormatSettings not being modified to the system's locale under Linux? And if so, can someone please point me and @wp to that place?! In the mean time, I'm gonna ask how this is done in Go( for example ) to one of the AI Bots. Cheers, Gus ---------------------------------------------------------------------- Gustavo 'Gus' Carreno · 2025-06-28 17:41 Hey Y'All, Ok, after asking the AI Bot, my investigation is now around the fact that in Linux, all this is managed by setlocale. Then, we can query for LC_NUMERIC and the other such constants to fill DefaultFormatSettings. Actually, under the clocale unit, this is already done. And I suspect that this is what's called internally in the process of getting such values when a GUI app is started. But as I realised before, the clocale is just a bunch of code that is called in it's initiliazation, but does not provide such tools for us to play about!!! The problem is this: clocale DOES update DefaultFormatSettings, BUT it does so with only the system settings. What we would wish is that somewhere the same code can be used with a string containing the language and change it to that. I'm aware that it's rather safe to only do this using the system's locale. This ensures that we get all correct stuff, since the user has taken care of that in the system's settings. Nonetheless, I would prefer that this could be allowed to be handled by the programmer. This is an Open Source language, after all, and it's common in such an environment to be spoiled with choice. While the core devs ponder my question, I'll copy clocale to a test folder and see what I can hack. Even if it explodes in my face @wp I'll keep you posted via private messages of my efforts!! If successful, we can add my code to the code you attached that works on Windows. Cheers, Gus ---------------------------------------------------------------------- wp · 2025-06-28 17:56 Long time gone... As for the system's formatsettings, add unit "clocale" to the uses clause - there was a discussion about it recently. As for any arbitrary language, I still don't know, but looking at the sources of clocale I get the expression that it might serve as a guideline to find out. ---------------------------------------------------------------------- wp · 2025-06-28 18:03 Quote from: Gustavo 'Gus' Carreno on June 28, 2025, 07:41:28 pmI'll copy clocale to a test folder and see what I can hack. Even if it explodes in my face Yes, that's what I'd do: Copy clocale to a test folder, add an overladed procedure "GetFormatSettings(ALang: String; out fmts: TFormatSettings)". Copy the original procedure. Immediately after the "begin" replace "setlocale(__LCL_ALL, '')" by "setlocale(__LCL_ALL, ALang)", and see what happens... ---------------------------------------------------------------------- Gustavo 'Gus' Carreno · 2025-06-28 18:20 Hey WP, Quote from: wp on June 28, 2025, 08:03:06 pmYes, that's what I'd do: Copy clocale to a test folder, add an overladed procedure "GetFormatSettings(ALang: String; out fmts: TFormatSettings)". Copy the original procedure. Immediately after the "begin" replace "setlocale(__LCL_ALL, '')" by "setlocale(__LCL_ALL, ALang)", and see what happens... You read my mind !!! Great minds and all that !!! I'm gonna do this and add it to my Test* with a waning: Here be Dragons !!! I'll keep you posted here!! I've already installed the Portuguese language on my Ubuntu system, to see if that will not go BOOM if I test it with that( not sure I need a reboot after installing it ). But I'll try German and French, just to see how it goes up in flames  Cheers, Gus ---------------------------------------------------------------------- Gustavo 'Gus' Carreno · 2025-06-28 21:36 Hey WP, SUCCESS!!!! I was finally able to force the thang my way: Test Locale. It has a big caveat: The system must have the language installed, or else it will not work. In my case, I have English and Portuguese installed. I was able to get the different format settings for both. But since I don't have French nor German, only the language of the app changes, not the DefaultFormatSettings. While this is a nice proof of concept, it fails due to the fact that we depend on the system, not on a set of .po files I think it would be a bit more practical to implement something based on a JSON file, or something like this... This way we can provide the file in the locale folder with the project... Something to think about... Cheers, Gus ---------------------------------------------------------------------- wp · 2025-06-28 21:42 Why not declare resource strings for DecimalSeparator, Thousandsepator, month names, day names and whatever? Then they will be in the po file and can be translated. And after you called TranslateUnitResourceString you can pass them to the FormatSettings. This system will work for all operating systems for any language for which you have a translation, no clocale needed in Linux (and mac?) ---------------------------------------------------------------------- Gustavo 'Gus' Carreno · 2025-06-28 21:44 Hey WP, Quote from: wp on June 28, 2025, 11:42:21 pmWhy not declare resource strings for DecimalSeparator, Thousandsepator, month names, day names and whatever? Then they will be in the po file and can be translated. And after you called TranslateUnitResourceString you can pass them to the FormatSettings. This system will work for all operating systems for any language for which you have a translation, no clocale needed in Linux (and mac?) I'm soooo tired right now that this didn't even occurred to me!!! But of course that's a way better way to solve this!!! And in a single place !! Many thanks for the suggestion !!! Cheers, Gus