Changeset 416 for trunk/Settings.pas


Ignore:
Timestamp:
Nov 17, 2021, 10:47:48 AM (3 years ago)
Author:
chronos
Message:
  • Fixed: Use Common package translator to solve duplicate ULanguages unit name.
  • Modified: Also automatically detect new localizations in Localization directory.
  • Fixed: Use localization files with first capital letter to work correctly on Linux.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Settings.pas

    r408 r416  
    5858{$R *.lfm}
    5959
     60uses
     61  Start;
     62
    6063var
    6164  SFullScreen, SGamma, SRestartMsg, SShortCutPrimary, SShortCutSecondary,
     
    193196begin
    194197  ReloadLanguages;
    195   Languages.LoadToStrings(ListLanguages.Items);
     198  StartDlg.Translator.LanguageListToStrings(ListLanguages.Items);
    196199  ListLanguages.Font.Color := MainTexture.ColorMark;
    197200  ListKeyBindings.Font.Color := MainTexture.ColorMark;
     
    260263procedure TSettingsDlg.LoadData;
    261264begin
    262   ListLanguages.ItemIndex := Languages.Search(LocaleCode);
    263   if (ListLanguages.ItemIndex = -1) and (Languages.Count > 0) then
    264     ListLanguages.ItemIndex := 0;
     265  StartDlg.Translator.Language := StartDlg.Translator.Languages.SearchByCode(LocaleCode);
     266  StartDlg.Translator.LanguageListToStrings(ListLanguages.Items, False);
     267  ListLanguages.ItemIndex := ListLanguages.Items.IndexOfObject(StartDlg.Translator.Language);
     268  if ListLanguages.ItemIndex = -1 then ListLanguages.ItemIndex := 0;
    265269  if FullScreen then ButtonFullscreen.ButtonIndex := 3
    266270    else ButtonFullscreen.ButtonIndex := 2;
     
    274278begin
    275279  NeedRestart := Gamma <> LocalGamma;
    276   LocaleCode := Languages[ListLanguages.ItemIndex].ShortName;
     280  if ListLanguages.ItemIndex <> -1 then begin
     281    StartDlg.Translator.Language := TLanguage(ListLanguages.Items.Objects[ListLanguages.ItemIndex]);
     282    LocaleCode := StartDlg.Translator.Language.Code;
     283  end else begin
     284    StartDlg.Translator.Language := nil;
     285    LocaleCode := '';
     286  end;
    277287  FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1;
    278288  Gamma := LocalGamma;
Note: See TracChangeset for help on using the changeset viewer.