Changeset 228 for CoolTranslator


Ignore:
Timestamp:
Apr 7, 2011, 8:05:17 AM (14 years ago)
Author:
george
Message:
  • Added: Language list of all languages with their codes.
Location:
CoolTranslator
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • CoolTranslator/CoolTranslator.lpk

    r226 r228  
    99      <PathDelim Value="\"/>
    1010      <SearchPaths>
    11         <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\"/>
     11        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    1212      </SearchPaths>
    1313      <Other>
     
    1818    <License Value="GNU/GPL"/>
    1919    <Version Minor="1"/>
    20     <Files Count="1">
     20    <Files Count="2">
    2121      <Item1>
    2222        <Filename Value="UCoolTranslator.pas"/>
     
    2424        <UnitName Value="UCoolTranslator"/>
    2525      </Item1>
     26      <Item2>
     27        <Filename Value="ULanguages.pas"/>
     28        <UnitName Value="ULanguages"/>
     29      </Item2>
    2630    </Files>
     31    <i18n>
     32      <EnableI18N Value="True"/>
     33      <OutDir Value="Languages"/>
     34    </i18n>
    2735    <Type Value="RunAndDesignTime"/>
    2836    <RequiredPkgs Count="2">
  • CoolTranslator/CoolTranslator.pas

    r226 r228  
    88
    99uses
    10   UCoolTranslator, LazarusPackageIntf;
     10  UCoolTranslator, ULanguages, LazarusPackageIntf;
    1111
    1212implementation
  • CoolTranslator/UCoolTranslator.pas

    r226 r228  
    77uses
    88  Classes, SysUtils, Forms, StdCtrls, ExtCtrls, StrUtils, Controls, Contnrs,
    9   Translations, TypInfo, Dialogs, FileUtil, LCLProc;
     9  Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages;
    1010
    1111type
    12 
    13   TLanguage = class
    14     Name: string;
    15     Code: string;
    16   end;
    17 
    18   { TLanguageList }
    19 
    20   TLanguageList = class(TObjectList)
    21     function SearchByCode(ACode: string): TLanguage;
    22   end;
    23 
    2412  { TComponentExcludes }
    2513
     
    7462procedure Register;
    7563
    76 resourcestring
    77   SLanguageCzech = 'Czech';
    78   SLanguageEnglish = 'English';
    79   SLanguageAutomatic = 'Automatic';
    80 
    81 
    8264implementation
    8365
     
    308290  inherited;
    309291  ComponentExcludes := TComponentExcludesList.Create;
     292  Languages := TLanguageList.Create;
     293  POFilesFolder := 'Languages';
     294
     295  // LCL
    310296  AddExcludes(TComponent, 'Name');
    311 
    312   Languages := TLanguageList.Create;
    313   with TLanguage(Languages[Languages.Add(TLanguage.Create)]) do begin
    314     Name := SLanguageAutomatic;
    315     Code := '';
    316   end;
    317   with TLanguage(Languages[Languages.Add(TLanguage.Create)]) do begin
    318     Name := SLanguageCzech;
    319     Code := 'cs';
    320   end;
    321   with TLanguage(Languages[Languages.Add(TLanguage.Create)]) do begin
    322     Name := SLanguageEnglish;
    323     Code := 'en';
    324   end;
     297  //AddExcludes(TAction, 'Category');
     298  AddExcludes(TControl, 'HelpKeyword');
    325299end;
    326300
     
    476450end;
    477451
    478 { TLanguageList }
    479 
    480 function TLanguageList.SearchByCode(ACode: string): TLanguage;
    481 var
    482   I: Integer;
    483 begin
    484   I := 0;
    485   while (I < Count) and (TLanguage(Items[I]).Code < ACode) do Inc(I);
    486   if I < Count then Result := TLanguage(Items[I])
    487     else Result := nil;
    488 end;
    489 
    490452
    491453end.
Note: See TracChangeset for help on using the changeset viewer.