mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 12:49:28 +02:00
added example for lcl/translations.pas
git-svn-id: trunk@8511 -
This commit is contained in:
parent
18e682b419
commit
59a8b3ba0d
@ -2475,8 +2475,8 @@ resourcestring
|
||||
lisA2PNoPackageFoundForDependencyPleaseChooseAnExisting = 'No package found '
|
||||
+'for dependency %s%s%s.%sPlease choose an existing package.';
|
||||
lisA2PInvalidUnitName = 'Invalid Unit Name';
|
||||
lisA2PTheUnitNameAndFilenameDiffer = 'The unit name %s%s%s and filename '
|
||||
+'differ.';
|
||||
lisA2PTheUnitNameAndFilenameDiffer = 'The unit name %s%s%s%sand filename %s%'
|
||||
+'s%s differ.';
|
||||
lisA2PFileAlreadyInPackage = 'File already in package';
|
||||
lisA2PTheFileIsAlreadyInThePackage = 'The file %s%s%s is already in the '
|
||||
+'package.';
|
||||
|
@ -23,6 +23,19 @@
|
||||
|
||||
Abstract:
|
||||
Methods and classes for loading translations/localizations from po files.
|
||||
|
||||
Example:
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
PODirectory: String;
|
||||
begin
|
||||
PODirectory:='/path/to/lazarus/lcl/languages/';
|
||||
TranslateUnitResourceStrings('LCLStrConsts',PODirectory+'lcl.%s.po',
|
||||
'nl','');
|
||||
MessageDlg('Title','Text',mtInformation,[mbOk,mbCancel,mbYes],0);
|
||||
end;
|
||||
|
||||
}
|
||||
unit Translations;
|
||||
|
||||
|
@ -456,10 +456,11 @@ begin
|
||||
OnGetIDEFileInfo,Params.UnitFilename) then exit;
|
||||
|
||||
// check unitname
|
||||
if AnsiCompareText(Params.UnitName,ExtractFileNameOnly(Params.UnitFilename))<>0
|
||||
if CompareText(Params.UnitName,ExtractFileNameOnly(Params.UnitFilename))<>0
|
||||
then begin
|
||||
MessageDlg(lisA2PInvalidUnitName,
|
||||
Format(lisA2PTheUnitNameAndFilenameDiffer, ['"', Params.UnitName, '"']),
|
||||
Format(lisA2PTheUnitNameAndFilenameDiffer, ['"',
|
||||
Params.UnitName, '"', #13, '"', Params.UnitFilename, '"']),
|
||||
mtError,[mbCancel],0);
|
||||
exit;
|
||||
end;
|
||||
@ -824,10 +825,12 @@ begin
|
||||
if CompareText(CurParams.UnitName,
|
||||
ExtractFileNameOnly(CurParams.UnitFilename))<>0
|
||||
then begin
|
||||
MessageDlg(lisA2PInvalidUnitName,
|
||||
Format(lisA2PTheUnitNameAndFilenameDiffer, ['"', CurParams.UnitName, '"']),
|
||||
mtError,[mbCancel],0);
|
||||
exit;
|
||||
if MessageDlg(lisA2PInvalidUnitName,
|
||||
Format(lisA2PTheUnitNameAndFilenameDiffer, ['"',
|
||||
CurParams.UnitName, '"', #13, '"', CurParams.UnitFilename, '"']),
|
||||
mtError,[mbIgnore,mbCancel],0)<>mrIgnore
|
||||
then
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
LastParams:=CurParams;
|
||||
@ -858,6 +861,12 @@ begin
|
||||
OpenDialog.Title:=lisOpenFile;
|
||||
OpenDialog.Options:=OpenDialog.Options
|
||||
+[ofFileMustExist,ofPathMustExist,ofAllowMultiSelect];
|
||||
OpenDialog.Filter:=dlgAllFiles+' ('+GetAllFilesMask+')|'+GetAllFilesMask
|
||||
+'|'+lisLazarusUnit+' (*.pas;*.pp)|*.pas;*.pp'
|
||||
+'|'+lisLazarusProject+' (*.lpi)|*.lpi'
|
||||
+'|'+lisLazarusForm+' (*.lfm)|*.lfm'
|
||||
+'|'+lisLazarusPackage+' (*.lpk)|*.lpk'
|
||||
+'|'+lisLazarusProjectSource+' (*.lpr)|*.lpr';
|
||||
if OpenDialog.Execute then begin
|
||||
for i:=0 to OpenDialog.Files.Count-1 do begin
|
||||
AFilename:=CleanAndExpandFilename(OpenDialog.Files[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user