Changeset 456 for trunk/Packages/Common/Translator.pas
- Timestamp:
- May 30, 2023, 11:31:10 AM (18 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Translator.pas
r455 r456 1 unit UTranslator;1 unit Translator; 2 2 3 3 interface … … 5 5 uses 6 6 Classes, SysUtils, Forms, ExtCtrls, Controls, LazFileUtils, LazUTF8, 7 Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType,7 Translations, TypInfo, Dialogs, FileUtil, LCLProc, Languages, LCLType, 8 8 LCLVersion, Generics.Collections; 9 9 … … 420 420 421 421 if Lang = '' then begin 422 for I:= 1 to Paramcount - 1 do423 if (ParamStr( I) = '--LANG') or (ParamStr(I) = '-l') or424 (ParamStr( I) = '--lang') then425 Lang := ParamStr( I+ 1);422 for i := 1 to Paramcount - 1 do 423 if (ParamStr(i) = '--LANG') or (ParamStr(i) = '-l') or 424 (ParamStr(i) = '--lang') then 425 Lang := ParamStr(i + 1); 426 426 end; 427 427 if Lang = '' then begin … … 473 473 DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt); 474 474 if FileExistsUTF8(Result) then 475 Exit;475 exit; 476 476 477 477 Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator + LangID + 478 478 DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt); 479 479 if FileExistsUTF8(Result) then 480 Exit;480 exit; 481 481 482 482 Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator 483 483 + LangID + DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt); 484 484 if FileExistsUTF8(Result) then 485 Exit;485 exit; 486 486 487 487 Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator … … 489 489 ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt); 490 490 if FileExistsUTF8(Result) then 491 Exit;491 exit; 492 492 493 493 {$IFDEF UNIX} … … 496 496 ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt); 497 497 if FileExistsUTF8(Result) then 498 Exit;498 exit; 499 499 {$ENDIF} 500 500 // Let us search for reducted files 501 LangShortID := Copy(LangID, 1, 2);501 LangShortID := copy(LangID, 1, 2); 502 502 // At first, check all was checked 503 503 Result := ExtractFilePath(ParamStrUTF8(0)) + LangShortID + 504 504 DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt); 505 505 if FileExistsUTF8(Result) then 506 Exit;506 exit; 507 507 508 508 Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator + … … 510 510 ExtractFileName(ParamStrUTF8(0)), LCExt); 511 511 if FileExistsUTF8(Result) then 512 Exit;512 exit; 513 513 514 514 Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator … … 516 516 ExtractFileName(ParamStrUTF8(0)), LCExt); 517 517 if FileExistsUTF8(Result) then 518 Exit;518 exit; 519 519 520 520 Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator … … 522 522 ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt); 523 523 if FileExistsUTF8(Result) then 524 Exit;524 exit; 525 525 526 526 // Full language in file name - this will be default for the project … … 529 529 Result := ExtractFilePath(ParamStrUTF8(0)) + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt; 530 530 if FileExistsUTF8(Result) then 531 Exit;531 exit; 532 532 // Common location (like in Lazarus) 533 533 Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator + 534 534 ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt; 535 535 if FileExistsUTF8(Result) then 536 Exit;536 exit; 537 537 538 538 Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + 539 539 DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt; 540 540 if FileExistsUTF8(Result) then 541 Exit;541 exit; 542 542 except 543 543 Result := ''; // Or do something else (useless) … … 548 548 ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt); 549 549 if FileExistsUTF8(Result) then 550 Exit;550 exit; 551 551 {$ENDIF} 552 552 Result := ExtractFilePath(ParamStrUTF8(0)) + ChangeFileExt( 553 553 ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt; 554 554 if FileExistsUTF8(Result) then 555 Exit;555 exit; 556 556 557 557 Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator + 558 558 ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt; 559 559 if FileExistsUTF8(Result) then 560 Exit;560 exit; 561 561 562 562 Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator + 563 563 ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt; 564 564 if FileExistsUTF8(Result) then 565 Exit;565 exit; 566 566 end; 567 567 … … 569 569 end; 570 570 571 572 571 end. 573
Note:
See TracChangeset
for help on using the changeset viewer.