diff options
Diffstat (limited to 'ULocale.pas')
| -rw-r--r-- | ULocale.pas | 25 |
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; |
