Changeset 23 for trunk/UCore.pas


Ignore:
Timestamp:
Aug 19, 2021, 11:47:56 AM (3 years ago)
Author:
chronos
Message:
  • Added: Snap package definition file.
  • Fixed: Selected theme in settings also changed language.
  • Modified: Load correctly language files if installed on Linux.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r22 r23  
    4141    ActionList1: TActionList;
    4242    ApplicationInfo1: TApplicationInfo;
    43     CoolTranslator1: TTranslator;
     43    Translator: TTranslator;
    4444    ImageList1: TImageList;
    4545    LastOpenedList1: TLastOpenedList;
     
    273273
    274274procedure TCore.DataModuleCreate(Sender: TObject);
    275 begin
     275const
     276  LinuxLanguagesDir = '/usr/share/vCardStudio/Languages';
     277begin
     278  {$IFDEF Linux}
     279  // If installed in Linux system then use installation directory for po files
     280  if not DirectoryExists(Translator.POFilesFolder) and DirectoryExists(LinuxLanguagesDir) then
     281    Translator.POFilesFolder := LinuxLanguagesDir;
     282  {$ENDIF}
     283
    276284  DataFile := nil;
    277285  DefaultDataFileClass := TContactsFile;
     
    396404    CurrentContext := ApplicationInfo1.GetRegistryContext;
    397405    if ValueExists('LanguageCode') then
    398       CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
    399       else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('');
     406      Translator.Language := Translator.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
     407      else Translator.Language := Translator.Languages.SearchByCode('');
    400408    if ValueExists('Theme') then
    401409      ThemeManager1.Theme := ThemeManager1.Themes.FindByName(ReadStringWithDefault('Theme', 'System'))
     
    416424  try
    417425    CurrentContext := ApplicationInfo1.GetRegistryContext;
    418     if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then
    419       WriteString('LanguageCode', CoolTranslator1.Language.Code)
     426    if Assigned(Translator.Language) and (Translator.Language.Code <> '') then
     427      WriteString('LanguageCode', Translator.Language.Code)
    420428      else DeleteValue('LanguageCode');
    421429    if Assigned(ThemeManager1.Theme) and (ThemeManager1.Theme.Name <> '') then
Note: See TracChangeset for help on using the changeset viewer.