Ignore:
Timestamp:
Nov 25, 2017, 12:27:33 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Improved New game window.
  • Modified: Used newer version of Common and CoolTranslator packages.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33backup
        44tunneler.exe
         5tunneler.dbg
         6tunneler.lps
        57heaptrclog.trc
        6 tunneler.lps
         8Components/Common/Languages/*.mo
         9Components/CoolTranslator/Demo/lib
  • trunk/Components/CoolTranslator/Demo/Languages/TranslatorDemo.cs.po

    r30 r34  
    1010"Content-Transfer-Encoding: 8bit\n"
    1111
    12 #: TFORM1.FORM1.CAPTION
     12#: tform1.form1.caption
    1313msgctxt "TFORM1.FORM1.CAPTION"
    1414msgid "Translator Demo"
    1515msgstr "Ukázka Translatoru"
    1616
    17 #: TMAINFORM.BUTTON1.CAPTION
     17#: tmainform.button1.caption
    1818msgid "Show MainForm.Name"
    1919msgstr "Ukázat MainForm.Name"
    2020
    21 #: TMAINFORM.CAPTION
     21#: tmainform.caption
    2222msgctxt "TMAINFORM.CAPTION"
    2323msgid "Translator Demo"
    2424msgstr "Ukázka Translatoru"
    2525
    26 #: TMAINFORM.LABEL1.CAPTION
     26#: tmainform.label1.caption
    2727msgid "MainForm"
    2828msgstr "HlavníFormulář"
    2929
    30 #: TMAINFORM.LABEL2.CAPTION
     30#: tmainform.label2.caption
    3131msgid "Form name as label caption:"
    3232msgstr "Jméno formuláře jako titulek textu:"
    3333
    34 #: TMAINFORM.LABEL3.CAPTION
     34#: tmainform.label3.caption
    3535msgid "Language list:"
    3636msgstr ""
    3737
    38 #: TMAINFORM.LABEL4.CAPTION
     38#: tmainform.label4.caption
    3939msgid "Excludes:"
    4040msgstr ""
  • trunk/Components/CoolTranslator/Demo/Languages/TranslatorDemo.de.po

    r30 r34  
    22msgstr "Content-Type: text/plain; charset=UTF-8"
    33
    4 #: TFORM1.FORM1.CAPTION
     4#: tform1.form1.caption
    55msgctxt "TFORM1.FORM1.CAPTION"
    66msgid "Translator Demo"
    77msgstr ""
    88
    9 #: TMAINFORM.BUTTON1.CAPTION
     9#: tmainform.button1.caption
    1010msgid "Show MainForm.Name"
    1111msgstr ""
    1212
    13 #: TMAINFORM.CAPTION
     13#: tmainform.caption
    1414msgctxt "TMAINFORM.CAPTION"
    1515msgid "Translator Demo"
    1616msgstr ""
    1717
    18 #: TMAINFORM.LABEL1.CAPTION
     18#: tmainform.label1.caption
    1919msgid "MainForm"
    2020msgstr ""
    2121
    22 #: TMAINFORM.LABEL2.CAPTION
     22#: tmainform.label2.caption
    2323msgid "Form name as label caption:"
    2424msgstr ""
    2525
    26 #: TMAINFORM.LABEL3.CAPTION
     26#: tmainform.label3.caption
    2727msgid "Language list:"
    2828msgstr ""
    2929
    30 #: TMAINFORM.LABEL4.CAPTION
     30#: tmainform.label4.caption
    3131msgid "Excludes:"
    3232msgstr ""
  • trunk/Components/CoolTranslator/Demo/Languages/TranslatorDemo.po

    r30 r34  
    22msgstr "Content-Type: text/plain; charset=UTF-8"
    33
    4 #: TFORM1.FORM1.CAPTION
     4#: tform1.form1.caption
    55msgctxt "TFORM1.FORM1.CAPTION"
    66msgid "Translator Demo"
    77msgstr ""
    88
    9 #: TMAINFORM.BUTTON1.CAPTION
     9#: tmainform.button1.caption
    1010msgid "Show MainForm.Name"
    1111msgstr ""
    1212
    13 #: TMAINFORM.CAPTION
     13#: tmainform.caption
    1414msgctxt "TMAINFORM.CAPTION"
    1515msgid "Translator Demo"
    1616msgstr ""
    1717
    18 #: TMAINFORM.LABEL1.CAPTION
     18#: tmainform.label1.caption
    1919msgid "MainForm"
    2020msgstr ""
    2121
    22 #: TMAINFORM.LABEL2.CAPTION
     22#: tmainform.label2.caption
    2323msgid "Form name as label caption:"
    2424msgstr ""
    2525
    26 #: TMAINFORM.LABEL3.CAPTION
     26#: tmainform.label3.caption
    2727msgid "Language list:"
    2828msgstr ""
    2929
    30 #: TMAINFORM.LABEL4.CAPTION
     30#: tmainform.label4.caption
    3131msgid "Excludes:"
    3232msgstr ""
  • trunk/Components/CoolTranslator/Demo/TranslatorDemo.lpi

    r30 r34  
    5151        <IsPartOfProject Value="True"/>
    5252        <ComponentName Value="MainForm"/>
     53        <HasResources Value="True"/>
    5354        <ResourceBaseClass Value="Form"/>
    5455        <UnitName Value="UMainForm"/>
     56        <IsVisibleTab Value="True"/>
    5557        <EditorIndex Value="0"/>
    5658        <WindowIndex Value="0"/>
     
    7981        <Filename Value="..\UCoolTranslator.pas"/>
    8082        <UnitName Value="UCoolTranslator"/>
    81         <IsVisibleTab Value="True"/>
    8283        <EditorIndex Value="1"/>
    8384        <WindowIndex Value="0"/>
    8485        <TopLine Value="274"/>
    85         <CursorPos X="1" Y="286"/>
     86        <CursorPos X="33" Y="288"/>
    8687        <UsageCount Value="11"/>
    8788        <Loaded Value="True"/>
     
    265266  </ProjectOptions>
    266267  <CompilerOptions>
    267     <Version Value="10"/>
     268    <Version Value="11"/>
    268269    <PathDelim Value="\"/>
    269270    <Target>
     
    275276    </SearchPaths>
    276277    <Linking>
    277       <Debugging>
    278         <GenerateDebugInfo Value="True"/>
    279         <DebugInfoType Value="dsAuto"/>
    280       </Debugging>
    281278      <Options>
    282279        <Win32>
     
    305302    </Exceptions>
    306303  </Debugging>
     304  <EditorMacros Count="0"/>
    307305</CONFIG>
  • trunk/Components/CoolTranslator/Demo/UMainForm.lfm

    r30 r34  
    88  ClientWidth = 466
    99  OnCreate = FormCreate
    10   LCLVersion = '0.9.31'
     10  LCLVersion = '1.1'
    1111  object ListBox1: TListBox
    1212    Left = 171
     
    2929  object Label1: TLabel
    3030    Left = 10
    31     Height = 14
     31    Height = 13
    3232    Top = 24
    33     Width = 47
     33    Width = 46
    3434    Caption = 'MainForm'
    3535    ParentColor = False
     
    3737  object Label2: TLabel
    3838    Left = 10
    39     Height = 14
     39    Height = 13
    4040    Top = 6
    41     Width = 135
     41    Width = 134
    4242    Caption = 'Form name as label caption:'
    4343    ParentColor = False
     
    4545  object Label3: TLabel
    4646    Left = 171
    47     Height = 14
     47    Height = 13
    4848    Top = 8
    49     Width = 68
     49    Width = 67
    5050    Caption = 'Language list:'
    5151    ParentColor = False
     
    6161  object Label4: TLabel
    6262    Left = 321
    63     Height = 14
     63    Height = 13
    6464    Top = 10
    65     Width = 47
     65    Width = 46
    6666    Caption = 'Excludes:'
    6767    ParentColor = False
     
    6969  object CoolTranslator1: TCoolTranslator
    7070    POFilesFolder = 'Languages'
    71     left = 64
    72     top = 40
     71    left = 72
     72    top = 72
    7373  end
    7474end
  • trunk/Components/CoolTranslator/UCoolTranslator.pas

    r30 r34  
    66
    77uses
    8   Classes, SysUtils, Forms, StdCtrls, ExtCtrls, StrUtils, Controls, Contnrs,
     8  Classes, SysUtils, Forms, ExtCtrls, Controls, Contnrs, LazFileUtils, LazUTF8,
    99  Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType;
    1010
     
    4646    procedure TranslateProperty(Component: TPersistent; PropInfo: PPropInfo);
    4747    function IsExcluded(Component: TPersistent; PropertyName: string): Boolean;
     48    function GetLangFileDir: string;
    4849  public
    4950    ComponentExcludes: TComponentExcludesList;
     
    150151  I: Integer;
    151152  LocaleShort: string;
     153  SearchMask: string;
    152154begin
    153155  FPOFiles.Clear;
     
    157159    //ShowMessage(ExtractFileDir(Application.ExeName) +
    158160    //  DirectorySeparator + 'Languages' + ' ' + '*.' + LocaleShort + '.po');
    159     FileList := FindAllFiles(ExtractFileDir(UTF8Encode(Application.ExeName)) +
    160       DirectorySeparator + FPOFilesFolder, '*.' + LocaleShort + '.po');
     161    SearchMask := '*';
     162    if LocaleShort <> '' then SearchMask := SearchMask + '.' + LocaleShort;
     163    SearchMask := SearchMask + '.po';
     164    FileList := FindAllFiles(GetLangFileDir, SearchMask);
    161165    for I := 0 to FileList.Count - 1 do begin
    162166      FileName := FileList[I];
    163167      //FileName := FindLocaleFileName('.po');
    164       if FileExistsUTF8(FileName) then FPOFiles.Add(TPOFile.Create(FileName));
     168      if FileExists(FileName) and (
     169      ((LocaleShort = '') and (Pos('.', FileName) = Pos('.po', FileName))) or
     170      (LocaleShort <> '')) then FPOFiles.Add(TPOFile.Create(FileName));
    165171    end;
    166172  finally
     
    174180  FPoFilesFolder := AValue;
    175181  ReloadFiles;
     182  CheckLanguageFiles;
    176183end;
    177184
     
    223230var
    224231  PropType: PTypeInfo;
    225   Parent: TObject;
    226232  Obj: TObject;
    227233  I: Integer;
     
    285291end;
    286292
     293function TCoolTranslator.GetLangFileDir: string;
     294begin
     295  Result := FPOFilesFolder;
     296  if Copy(Result, 1, 1) <> DirectorySeparator then
     297    Result := ExtractFileDir(UTF8Encode(Application.ExeName)) +
     298      DirectorySeparator + Result;
     299end;
     300
    287301procedure TCoolTranslator.LanguageListToStrings(Strings: TStrings);
    288302var
     
    317331  I: Integer;
    318332begin
     333  Result := '';
    319334  if Text <> '' then begin
    320335    for I := 0 to FPoFiles.Count - 1 do begin
     
    343358var
    344359  I: Integer;
    345 begin
     360  LangDir: string;
     361begin
     362  LangDir := GetLangFileDir;
    346363  TLanguage(Languages[0]).Available := True; // Automatic
    347364
    348365  for I := 1 to Languages.Count - 1 do
    349366  with TLanguage(Languages[I]) do begin
    350     Available := FileExistsUTF8(POFilesFolder + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
     367    Available := FileExists(LangDir + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
    351368      '.' + Code + ExtensionSeparator + 'po') or (Code = 'en');
    352369  end;
     
    383400begin
    384401  // Win32 user may decide to override locale with LANG variable.
    385   Lang := GetEnvironmentVariableUTF8('LANG');
     402  Lang := GetEnvironmentVariable('LANG');
    386403
    387404  // Use user selected language
     
    391408  if Lang = '' then begin
    392409    for i := 1 to Paramcount - 1 do
    393       if (ParamStrUTF8(i) = '--LANG') or (ParamStrUTF8(i) = '-l') or
    394         (ParamStrUTF8(i) = '--lang') then
    395         Lang := ParamStrUTF8(i + 1);
     410      if (ParamStr(i) = '--LANG') or (ParamStr(i) = '-l') or
     411        (ParamStr(i) = '--lang') then
     412        Lang := ParamStr(i + 1);
    396413  end;
    397414  if Lang = '' then
    398     LCLGetLanguageIDs(Lang, T);
     415    LazGetLanguageIDs(Lang, T);
    399416
    400417  if Assigned(Language) and (Language.Code = '') and Assigned(FOnAutomaticLanguage) then begin
     
    402419  end;
    403420
    404   if Lang = 'en' then Lang := ''; // English files are without en code
    405 
    406421  Result := Lang;
    407422end;
     
    415430var
    416431  T: string;
    417   I: Integer;
    418432  Lang: string;
    419433begin
     
    425439    Exit;
    426440
    427   Result := ChangeFileExt(ParamStrUTF8(0), LCExt);
     441  Result := ChangeFileExt(ParamStr(0), LCExt);
    428442  if FileExistsUTF8(Result) then
    429443    Exit;
Note: See TracChangeset for help on using the changeset viewer.