From bb9ed7f37c402fbbec1ad3bad565c837374a0212 Mon Sep 17 00:00:00 2001 From: riderkick Date: Sun, 14 Jun 2015 14:46:12 +0800 Subject: [PATCH] utranslation, small changes --- baseunits/utranslation.pas | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/baseunits/utranslation.pas b/baseunits/utranslation.pas index dc51b5891..9bac7ef1e 100644 --- a/baseunits/utranslation.pas +++ b/baseunits/utranslation.pas @@ -29,12 +29,12 @@ interface LResources, Forms; type - TPoLanguage = record + TLanguageItem = record id: String; name: String; end; - TPoLanguages = array of TPoLanguage; + TLanguageCollection = array of TLanguageItem; const Lang_english: array[0..184] of array[0..1] of string = ( @@ -915,17 +915,16 @@ function SetLang(lang: string; appname: string): Boolean; else appname := ExtractFileNameOnly(ParamStrUTF8(0)); end; - - //po file lfile := LangDir + PathDelim + appname + '.' + lang; - if FileExistsUTF8(lfile + '.po') then + + if FileExistsUTF8(lfile + '.po') then //po file begin lfile := lfile + '.po'; - TranslateResourceStrings(lfile); + Translations.TranslateResourceStrings(lfile); ltrans := TPOTranslator.Create(lfile); end - //mo file - else if FileExistsUTF8(lfile + '.mo') then + else + if FileExistsUTF8(lfile + '.mo') then //mo file begin lfile := lfile + '.mo'; gettext.TranslateResourceStrings(lfile); @@ -941,9 +940,9 @@ function SetLang(lang: string; appname: string): Boolean; LRSTranslator := ltrans; for i := 0 to Screen.CustomFormCount-1 do ltrans.UpdateTranslation(Screen.CustomForms[i]); + LastSelected := lang; + Result := True; end; - LastSelected := lang; - Result := True; end; end;