summaryrefslogtreecommitdiff
path: root/ULocale.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2024-12-23 23:59:45 +0100
committerTomas Bzatek <tbzatek@redhat.com>2025-11-27 19:36:10 +0100
commitb9703b29819b619037cc282d719c187e51bacd30 (patch)
treebd6d73e5fb6bcb6eb307844103b3dff185f2ac9a /ULocale.pas
parenta9634b933f71a9045e61d29c486f2d51d39fd1e2 (diff)
downloadtuxcmd-b9703b29819b619037cc282d719c187e51bacd30.tar.xz
Port to g-i generated glib2 bindings
Includes switch to FPC -Mobjfpc and related pointer style fixes.
Diffstat (limited to 'ULocale.pas')
-rw-r--r--ULocale.pas25
1 files changed, 13 insertions, 12 deletions
diff --git a/ULocale.pas b/ULocale.pas
index d591187..5fc62a0 100644
--- a/ULocale.pas
+++ b/ULocale.pas
@@ -251,10 +251,11 @@ uses SysUtils, UTranslation_EN, UTranslation_CZ, UTranslation_RU, UTranslation_D
UTranslation_ES, UTranslation_PL, UTranslation_UA, UTranslation_SR, UTranslation_HU, UTranslation_IT,
UTranslation_CHT, UTranslation_CHS, UTranslation_SK, UTranslation_PT, UTranslation_KO;
-
+type PLangProc = ^TLangProc;
+ TLangProc = procedure ();
const LangTable: array of string = nil;
- LangProcTable: array of pointer = nil;
+ LangProcTable: array of PLangProc = nil;
var Lang: string;
@@ -281,7 +282,7 @@ end;
procedure SetTranslationTexts(ForceLocale: string = '');
var LangIdx: integer;
- SetProc: procedure;
+ SetProc: TLangProc;
begin
if not (Assigned(LangTable) and (Length(LangTable) > 0)) then begin
WriteLn('**** tuxcmd CRITICAL: No usable translations found. At least one is required. Probably you have compiled the application incorrectly.');
@@ -290,10 +291,10 @@ begin
// Assign default language - English
try
Lang := 'EN';
- LangIdx := LookupLanguages;
+ LangIdx := LookupLanguages();
if LangIdx >= 0 then begin
- SetProc := LangProcTable[LangIdx];
- SetProc;
+ SetProc := TLangProc(LangProcTable[LangIdx]);
+ SetProc();
end;
except end;
// Assign other languages
@@ -305,22 +306,22 @@ begin
if Length(Trim(Lang)) = 0 then Lang := 'en_US'; // Default language
end else Lang := ForceLocale;
Lang := Trim(AnsiUpperCase(Lang));
- LangIdx := LookupLanguages;
+ LangIdx := LookupLanguages();
if (LangIdx = -1) and (Length(Lang) > 5) then begin
Lang := Copy(Lang, 1, 5);
- LangIdx := LookupLanguages;
+ LangIdx := LookupLanguages();
end;
if (LangIdx = -1) and (Length(Lang) > 2) then begin
Lang := Copy(Lang, 1, 2);
- LangIdx := LookupLanguages;
+ LangIdx := LookupLanguages();
end;
if LangIdx = -1 then begin
Lang := 'EN';
- LangIdx := LookupLanguages;
+ LangIdx := LookupLanguages();
end;
- SetProc := LangProcTable[LangIdx];
+ SetProc := TLangProc(LangProcTable[LangIdx]);
try
- SetProc;
+ SetProc();
except
on E: Exception do WriteLn('*** Exception ', E.ClassName, ' raised in SetProc - language ', LangTable[LangIdx], ', procedure @ ', integer(@SetProc), ': ', E.Message);
end;