From: DeaDDooMER Date: Sat, 27 May 2023 13:47:31 +0000 (+0300) Subject: gui: get only editor related translations X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=3c2fc40a5ba59f7570d4ae61c743de3ab1508434;p=d2df-editor.git gui: get only editor related translations --- diff --git a/src/editor/f_options.pas b/src/editor/f_options.pas index 51f2ea6..aa7012f 100644 --- a/src/editor/f_options.pas +++ b/src/editor/f_options.pas @@ -104,7 +104,7 @@ procedure RegisterFileType(ext: String; FileName: String); implementation uses - LazFileUtils, StrUtils, f_main, StdConvs, CONFIG, g_language, g_resources, g_options; + LazFileUtils, f_main, StdConvs, CONFIG, g_language, g_resources, g_options; {$R *.lfm} @@ -145,7 +145,8 @@ begin end; procedure TOptionsForm.FormActivate(Sender: TObject); - var info: TSearchRec; s: String; i: Integer; + const langfilename = 'editor'; + var info: TSearchRec; begin sDotColor.Brush.Color := DotColor; cbShowDots.Checked := DotEnable; @@ -172,14 +173,10 @@ begin cbLanguage.Items.BeginUpdate; cbLanguage.Items.Clear; cbLanguage.Items.Add('Auto'); - if FindFirst(LangDir + DirectorySeparator + '*.mo', faAnyFile, info) = 0 then + if FindFirst(LangDir + DirectorySeparator + langfilename + '.*.mo', faAnyFile, info) = 0 then begin repeat - s := ExtractFileNameWithoutExt(info.Name); - // TODO: check encoding part in name (editor.ru_RU.UTF-8.mo) - i := Max(RPos('.', s), 1); - s := Copy(s, i + 1, Length(s) - i); - cbLanguage.Items.Add(s); + cbLanguage.Items.Add(Copy(ExtractFileNameWithoutExt(info.Name), Length(langfilename) + 2)); until FindNext(info) <> 0; FindClose(info); end;