Changeset 463 for branches/highdpi/Packages/Common/Languages.pas
- Timestamp:
- Nov 29, 2023, 2:35:44 PM (12 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/Common/Languages.pas
r462 r463 1 unit ULanguages; 2 3 {$mode objfpc}{$H+} 1 unit Languages; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, Contnrs;6 Classes, SysUtils, Generics.Collections; 9 7 10 8 type … … 15 13 end; 16 14 17 { TLanguage List}18 19 TLanguage List = class(TObjectList)15 { TLanguages } 16 17 TLanguages = class(TObjectList<TLanguage>) 20 18 function SearchByCode(ACode: string): TLanguage; 21 19 procedure AddNew(Code: string; Name: string); 22 constructor Create ;20 constructor Create(FreeObjects: Boolean = True); 23 21 end; 24 22 … … 218 216 SLang_za = 'Zhuang'; 219 217 SLang_zh = 'Chinese'; 218 SLang_zh_Hans = 'Simplified Chinese'; 219 SLang_zh_Hant = 'Traditional Chinese'; 220 220 SLang_zu = 'Zulu'; 221 221 222 222 223 implementation 223 224 224 225 225 { TLanguage List}226 227 function TLanguage List.SearchByCode(ACode: string): TLanguage;226 { TLanguages } 227 228 function TLanguages.SearchByCode(ACode: string): TLanguage; 228 229 var 229 230 I: Integer; 230 231 begin 231 232 I := 0; 232 while (I < Count) and ( TLanguage(Items[I]).Code <ACode) do Inc(I);233 if I < Count then Result := TLanguage(Items[I])233 while (I < Count) and (Items[I].Code <> ACode) do Inc(I); 234 if I < Count then Result := Items[I] 234 235 else Result := nil; 235 236 end; 236 237 237 procedure TLanguage List.AddNew(Code: string; Name: string);238 procedure TLanguages.AddNew(Code: string; Name: string); 238 239 var 239 240 NewItem: TLanguage; … … 245 246 end; 246 247 247 constructor TLanguage List.Create;248 constructor TLanguages.Create(FreeObjects: Boolean); 248 249 begin 249 inherited Create;250 inherited; 250 251 AddNew('', SLangAuto); 251 252 AddNew('aa', SLang_aa); … … 441 442 AddNew('za', SLang_za); 442 443 AddNew('zh', SLang_zh); 444 AddNew('zh-Hant', SLang_zh_Hant); 445 AddNew('zh-Hans', SLang_zh_Hans); 443 446 AddNew('zu', SLang_zu); 444 447 end; 445 448 446 449 end. 447
Note:
See TracChangeset
for help on using the changeset viewer.