You've already forked lazarus-ccr
0.1.17.0: po files stored in resources
Use Project/Options/Resources in Laz 1.7+ Use LazRes to make a file 'translate.lrs' in older Laz (minesadorada) git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5434 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -15,6 +15,10 @@
|
|||||||
<TextDesc Value="Your application description."/>
|
<TextDesc Value="Your application description."/>
|
||||||
</XPManifest>
|
</XPManifest>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
|
<Resources Count="2">
|
||||||
|
<Resource_0 FileName="locale\jsoneditor.en.po" Type="RCDATA" ResourceName="JSONEDITOR.EN"/>
|
||||||
|
<Resource_1 FileName="locale\jsoneditor.es.po" Type="RCDATA" ResourceName="JSONEDITOR.ES"/>
|
||||||
|
</Resources>
|
||||||
</General>
|
</General>
|
||||||
<i18n>
|
<i18n>
|
||||||
<EnableI18N Value="True"/>
|
<EnableI18N Value="True"/>
|
||||||
|
@@ -4,13 +4,13 @@
|
|||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<Version Value="10"/>
|
<Version Value="10"/>
|
||||||
<BuildModes Active="Win64"/>
|
<BuildModes Active="Win64"/>
|
||||||
<Units Count="23">
|
<Units Count="24">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="jsonpackage.lpr"/>
|
<Filename Value="jsonpackage.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<CursorPos Y="30"/>
|
<CursorPos Y="30"/>
|
||||||
<UsageCount Value="76"/>
|
<UsageCount Value="78"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
@@ -20,12 +20,12 @@
|
|||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<TopLine Value="15"/>
|
<TopLine Value="34"/>
|
||||||
<CursorPos X="57" Y="44"/>
|
<CursorPos X="56" Y="60"/>
|
||||||
<UsageCount Value="76"/>
|
<UsageCount Value="78"/>
|
||||||
<Bookmarks Count="2">
|
<Bookmarks Count="2">
|
||||||
<Item0 Y="502" ID="1"/>
|
<Item0 Y="507" ID="1"/>
|
||||||
<Item1 Y="784"/>
|
<Item1 Y="791"/>
|
||||||
</Bookmarks>
|
</Bookmarks>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="ugenericcollection.pas"/>
|
<Filename Value="ugenericcollection.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="76"/>
|
<UsageCount Value="78"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="D:\Lazarusprojects\golfml\egacalculator\source\umainform.pas"/>
|
<Filename Value="D:\Lazarusprojects\golfml\egacalculator\source\umainform.pas"/>
|
||||||
@@ -154,9 +154,8 @@
|
|||||||
<Unit18>
|
<Unit18>
|
||||||
<Filename Value="D:\lazarustrunk\common_components\cryptini\ucryptini.pas"/>
|
<Filename Value="D:\lazarustrunk\common_components\cryptini\ucryptini.pas"/>
|
||||||
<EditorIndex Value="-1"/>
|
<EditorIndex Value="-1"/>
|
||||||
<TopLine Value="1023"/>
|
|
||||||
<CursorPos X="30" Y="1045"/>
|
<CursorPos X="30" Y="1045"/>
|
||||||
<UsageCount Value="9"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit18>
|
</Unit18>
|
||||||
<Unit19>
|
<Unit19>
|
||||||
<Filename Value="C:\NewPascalDarwin\lazarus\ide\revision.inc"/>
|
<Filename Value="C:\NewPascalDarwin\lazarus\ide\revision.inc"/>
|
||||||
@@ -176,9 +175,9 @@
|
|||||||
<Filename Value="C:\NewPascalDarwin\lazarus\lcl\translations.pas"/>
|
<Filename Value="C:\NewPascalDarwin\lazarus\lcl\translations.pas"/>
|
||||||
<UnitName Value="Translations"/>
|
<UnitName Value="Translations"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<TopLine Value="67"/>
|
<TopLine Value="76"/>
|
||||||
<CursorPos X="41" Y="90"/>
|
<CursorPos X="36" Y="82"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="12"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit21>
|
</Unit21>
|
||||||
<Unit22>
|
<Unit22>
|
||||||
@@ -186,6 +185,12 @@
|
|||||||
<EditorIndex Value="-1"/>
|
<EditorIndex Value="-1"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit22>
|
</Unit22>
|
||||||
|
<Unit23>
|
||||||
|
<Filename Value="C:\NewPascalDarwin\fpc\rtl\win\wininc\defines.inc"/>
|
||||||
|
<EditorIndex Value="-1"/>
|
||||||
|
<CursorPos X="64" Y="1204"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit23>
|
||||||
</Units>
|
</Units>
|
||||||
<OtherDefines Count="1">
|
<OtherDefines Count="1">
|
||||||
<Define0 Value="IGNOREPICTURE"/>
|
<Define0 Value="IGNOREPICTURE"/>
|
||||||
@@ -193,123 +198,123 @@
|
|||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="498" Column="75" TopLine="458"/>
|
<Caret Line="897" TopLine="850"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="77" Column="72" TopLine="43"/>
|
<Caret Line="904" Column="47" TopLine="862"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="568" Column="55" TopLine="545"/>
|
<Caret Line="898" Column="3" TopLine="863"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="57" TopLine="33"/>
|
<Caret Line="902" Column="44" TopLine="863"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="569" Column="43" TopLine="545"/>
|
<Caret Line="903" Column="42" TopLine="863"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="415" Column="4" TopLine="412"/>
|
<Caret Line="899" Column="45" TopLine="863"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="417" Column="54" TopLine="244"/>
|
<Caret Line="900" Column="44" TopLine="864"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="470" Column="3" TopLine="209"/>
|
<Caret Line="188" Column="4" TopLine="175"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="18" Column="40"/>
|
<Caret Line="900" Column="50" TopLine="864"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="464" TopLine="437"/>
|
<Caret Line="188" Column="4" TopLine="159"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="168" Column="18" TopLine="134"/>
|
<Caret Line="900" Column="45" TopLine="864"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="897" TopLine="850"/>
|
<Caret Line="188" TopLine="154"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="904" Column="47" TopLine="862"/>
|
<Caret Line="903" Column="34" TopLine="863"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="898" Column="3" TopLine="863"/>
|
<Caret Line="54" Column="49" TopLine="20"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="902" Column="44" TopLine="863"/>
|
<Caret Line="3"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="903" Column="42" TopLine="863"/>
|
<Caret Line="184" Column="23" TopLine="162"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="899" Column="45" TopLine="863"/>
|
<Caret Line="55" Column="78" TopLine="37"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="900" Column="44" TopLine="864"/>
|
<Caret Line="905" Column="26" TopLine="864"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="188" Column="4" TopLine="175"/>
|
<Caret Line="922" Column="5" TopLine="878"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="900" Column="50" TopLine="864"/>
|
<Caret Line="193" TopLine="183"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="188" Column="4" TopLine="159"/>
|
<Caret Line="63" Column="99" TopLine="31"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="900" Column="45" TopLine="864"/>
|
<Caret Line="947" Column="66" TopLine="917"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="188" TopLine="154"/>
|
<Caret Line="961" Column="56" TopLine="929"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="903" Column="34" TopLine="863"/>
|
<Caret Line="947" Column="65" TopLine="930"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="54" Column="49" TopLine="20"/>
|
<Caret Line="59" Column="78" TopLine="35"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="3"/>
|
<Caret Line="947" Column="75" TopLine="923"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="184" Column="23" TopLine="162"/>
|
<Caret Column="2"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="55" Column="78" TopLine="37"/>
|
<Caret Line="909" Column="20" TopLine="893"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="905" Column="26" TopLine="864"/>
|
<Caret Line="935" Column="35" TopLine="923"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="umain.pas"/>
|
<Filename Value="umain.pas"/>
|
||||||
<Caret Line="922" Column="5" TopLine="878"/>
|
<Caret Line="47" Column="57" TopLine="7"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectSession>
|
</ProjectSession>
|
||||||
|
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
unit umain;
|
unit umain;
|
||||||
{$DEFINE PO_RESOURCES}
|
|
||||||
{ OnlinePackageManager Update JSON Editor
|
{$DEFINE PO_BUILTINRES}// Use built-in resources for .po files
|
||||||
|
|
||||||
|
{ OnlinePackageManager Update JSON Editor
|
||||||
|
|
||||||
Copyright (C)2016 usernames lainz, minesadorada, GetMem @ http://forum.lazarus.freepascal.org/index.php
|
Copyright (C)2016 usernames lainz, minesadorada, GetMem @ http://forum.lazarus.freepascal.org/index.php
|
||||||
|
|
||||||
@@ -41,7 +43,9 @@ unit umain;
|
|||||||
0.1.15.0: BugFix: File/Save didn't add the '.json' suffix in Linux (minesadorada)
|
0.1.15.0: BugFix: File/Save didn't add the '.json' suffix in Linux (minesadorada)
|
||||||
Addition: After Loading, run validation tests(minesadorada)
|
Addition: After Loading, run validation tests(minesadorada)
|
||||||
0.1.16.0: Renamed ForceUpdate to ForceNotify (GetMem/minesadorada)
|
0.1.16.0: Renamed ForceUpdate to ForceNotify (GetMem/minesadorada)
|
||||||
0.1.17.0: po files stored in resource file as fallback (minesadorada)
|
0.1.17.0: po files stored in resources
|
||||||
|
Use Project/Options/Resources in Laz 1.7+
|
||||||
|
Use LazRes to make a file 'translate.lrs' in older Laz (minesadorada)
|
||||||
0.1.18.0: ??
|
0.1.18.0: ??
|
||||||
}
|
}
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
@@ -53,14 +57,14 @@ uses
|
|||||||
Classes, Forms, Controls, StdCtrls, Menus, ActnList, StdActns, Grids,
|
Classes, Forms, Controls, StdCtrls, Menus, ActnList, StdActns, Grids,
|
||||||
Graphics, Buttons, fileutil, LazFileUtils, fileinfo, ugenericcollection, fpjsonrtti,
|
Graphics, Buttons, fileutil, LazFileUtils, fileinfo, ugenericcollection, fpjsonrtti,
|
||||||
Dialogs, LCLTranslator, PopupNotifier, SysUtils, inifiles,
|
Dialogs, LCLTranslator, PopupNotifier, SysUtils, inifiles,
|
||||||
lclintf, lclVersion{$IFDEF PO_RESOURCES},LResources, LazUTF8Classes{$ENDIF};
|
lclintf, lclVersion,{$IFDEF PO_BUILTINRES}LResources,LazUTF8Classes{$ENDIF};
|
||||||
|
|
||||||
CONST C_DEBUGMESSAGES=FALSE;
|
|
||||||
|
|
||||||
|
const
|
||||||
|
C_DEBUGMESSAGES = False;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
|
||||||
{ TUpdatePackageFiles }
|
{ TUpdatePackageFiles }
|
||||||
|
|
||||||
TUpdatePackageFiles = class(TCollectionItem)
|
TUpdatePackageFiles = class(TCollectionItem)
|
||||||
@@ -101,8 +105,10 @@ type
|
|||||||
function LoadFromFile(AFileName: string): boolean;
|
function LoadFromFile(AFileName: string): boolean;
|
||||||
function SaveToFile(AFileName: string): boolean;
|
function SaveToFile(AFileName: string): boolean;
|
||||||
published
|
published
|
||||||
property UpdatePackageData: TUpdatePackageData read FUpdatePackageData write FUpdatePackageData;
|
property UpdatePackageData: TUpdatePackageData
|
||||||
property UpdatePackageFiles: TPackageFilesList read FUpdatePackageFiles write FUpdatePackageFiles;
|
read FUpdatePackageData write FUpdatePackageData;
|
||||||
|
property UpdatePackageFiles: TPackageFilesList
|
||||||
|
read FUpdatePackageFiles write FUpdatePackageFiles;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TfrmMain }
|
{ TfrmMain }
|
||||||
@@ -166,24 +172,27 @@ type
|
|||||||
sUpdateDirectory, sZipDirectory: string;
|
sUpdateDirectory, sZipDirectory: string;
|
||||||
slErrorList: TStrings;
|
slErrorList: TStrings;
|
||||||
CFG: TIniFile;
|
CFG: TIniFile;
|
||||||
INIFilePath:String;
|
INIFilePath: string;
|
||||||
function ValidationFailed: boolean;
|
function ValidationFailed: boolean;
|
||||||
procedure CtrlShowPopup(Sender: TObject);
|
procedure CtrlShowPopup(Sender: TObject);
|
||||||
procedure CtrlHidePopup(Sender: TObject);
|
procedure CtrlHidePopup(Sender: TObject);
|
||||||
procedure CtrlSetUpPopupHandlers;
|
procedure CtrlSetUpPopupHandlers;
|
||||||
procedure CtrlMakeDirty(Sender: TObject);
|
procedure CtrlMakeDirty(Sender: TObject);
|
||||||
function FoundADuplicateLPK: boolean;
|
function FoundADuplicateLPK: boolean;
|
||||||
Function CreateUniqueINI(var aCount: integer):Boolean;
|
function CreateUniqueINI(var aCount: integer): boolean;
|
||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
frmMain: TfrmMain;
|
frmMain: TfrmMain;
|
||||||
{$IFDEF PO_RESOURCES}
|
sPoPath_en, sPoPath_es: string;
|
||||||
|
{$IFDEF PO_BUILTINRES}
|
||||||
aLRes: TLResource;
|
aLRes: TLResource;
|
||||||
aSS: TStringListUTF8;
|
aSS: TStringListUTF8;
|
||||||
{$ENDIF}
|
S: TResourceStream;
|
||||||
|
F: TFileStream;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -227,8 +236,8 @@ resourcestring
|
|||||||
rsLanguageChan = 'Language changed to "%s".';
|
rsLanguageChan = 'Language changed to "%s".';
|
||||||
rsSorryThisLan = 'Sorry, this language is unavailable at this time.';
|
rsSorryThisLan = 'Sorry, this language is unavailable at this time.';
|
||||||
rsYouMayNeedTo = '(You may need to restart the app to see the change)';
|
rsYouMayNeedTo = '(You may need to restart the app to see the change)';
|
||||||
rsThereAreOneO = '- There are one or more .lpk entries with the same name.%s'
|
rsThereAreOneO = '- There are one or more .lpk entries with the same name.%s' +
|
||||||
+ '- Every .lpk entry must have a unique name.';
|
'- Every .lpk entry must have a unique name.';
|
||||||
rsUpdateJsonSF = 'Update file "%s" failed to load correctly.';
|
rsUpdateJsonSF = 'Update file "%s" failed to load correctly.';
|
||||||
|
|
||||||
{ TUpdatePackageData }
|
{ TUpdatePackageData }
|
||||||
@@ -387,7 +396,7 @@ end;
|
|||||||
procedure TfrmMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure TfrmMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
begin
|
begin
|
||||||
CanClose := True;
|
CanClose := True;
|
||||||
if ((bDirty = True) AND (bDisableWarnings=FALSE)) then
|
if ((bDirty = True) and (bDisableWarnings = False)) then
|
||||||
begin
|
begin
|
||||||
if MessageDlg(rsFileMayBeUns, mtConfirmation, [mbYes, mbNo], 0, mbNo) = mrNo then
|
if MessageDlg(rsFileMayBeUns, mtConfirmation, [mbYes, mbNo], 0, mbNo) = mrNo then
|
||||||
CanClose := False;
|
CanClose := False;
|
||||||
@@ -399,18 +408,19 @@ begin
|
|||||||
CFG.UpdateFile;
|
CFG.UpdateFile;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
function TfrmMain.CreateUniqueINI(var aCount: integer):Boolean;
|
|
||||||
// Recursively loop until correct INI found, or new one created
|
function TfrmMain.CreateUniqueINI(var aCount: integer): boolean;
|
||||||
|
// Recursively loop until correct INI found, or new one created
|
||||||
begin
|
begin
|
||||||
Result:=FALSE;
|
Result := False;
|
||||||
INIFilePath := GetAppConfigFile(False) + IntToStr(aCount);
|
INIFilePath := GetAppConfigFile(False) + IntToStr(aCount);
|
||||||
CFG := TIniFile.Create(INIFilePath);
|
CFG := TIniFile.Create(INIFilePath);
|
||||||
CFG.CacheUpdates:=TRUE;
|
CFG.CacheUpdates := True;
|
||||||
if CFG.ReadString('Options', 'AppPath', ProgramDirectory) <> ProgramDirectory then
|
if CFG.ReadString('Options', 'AppPath', ProgramDirectory) <> ProgramDirectory then
|
||||||
begin
|
begin
|
||||||
FreeAndNil(CFG); // Ditch the old one
|
FreeAndNil(CFG); // Ditch the old one
|
||||||
Inc(aCount);
|
Inc(aCount);
|
||||||
Result:=TRUE;
|
Result := True;
|
||||||
CreateUniqueINI(aCount); // Make a new one
|
CreateUniqueINI(aCount); // Make a new one
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -418,7 +428,7 @@ end;
|
|||||||
procedure TfrmMain.FormCreate(Sender: TObject);
|
procedure TfrmMain.FormCreate(Sender: TObject);
|
||||||
var
|
var
|
||||||
sLang: string;
|
sLang: string;
|
||||||
iIniCount:Integer;
|
iIniCount: integer;
|
||||||
begin
|
begin
|
||||||
{
|
{
|
||||||
Self.AutoAdjustLayout(lapAutoAdjustForDPI, Self.DesignTimeDPI,
|
Self.AutoAdjustLayout(lapAutoAdjustForDPI, Self.DesignTimeDPI,
|
||||||
@@ -449,12 +459,12 @@ begin
|
|||||||
// Enable options persistence
|
// Enable options persistence
|
||||||
// If program location is different, create a new CFG file
|
// If program location is different, create a new CFG file
|
||||||
// Because each component's location might be different
|
// Because each component's location might be different
|
||||||
iIniCount:=0;
|
iIniCount := 0;
|
||||||
If CreateUniqueINI(iIniCount) then
|
if CreateUniqueINI(iIniCount) then
|
||||||
CFG.WriteString('Options', 'AppPath', ProgramDirectory);
|
CFG.WriteString('Options', 'AppPath', ProgramDirectory);
|
||||||
CFG.UpdateFile;
|
CFG.UpdateFile;
|
||||||
If C_DEBUGMESSAGES=TRUE then
|
if C_DEBUGMESSAGES = True then
|
||||||
ShowMessageFmt('Inifile=%s, Count=%d',[INIFilePath,iIniCount]);
|
ShowMessageFmt('Inifile=%s, Count=%d', [INIFilePath, iIniCount]);
|
||||||
// Pop-up hints (show on first run, then not again unless the user chooses)
|
// Pop-up hints (show on first run, then not again unless the user chooses)
|
||||||
bIsVirgin := CFG.ReadBool('Options', 'Virgin', True);
|
bIsVirgin := CFG.ReadBool('Options', 'Virgin', True);
|
||||||
bShowPopupHints := bIsVirgin;
|
bShowPopupHints := bIsVirgin;
|
||||||
@@ -479,8 +489,8 @@ end;
|
|||||||
|
|
||||||
procedure TfrmMain.FormDestroy(Sender: TObject);
|
procedure TfrmMain.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
CFG.Free;
|
CFG.Free;
|
||||||
slErrorList.Free;
|
slErrorList.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.FormShow(Sender: TObject);
|
procedure TfrmMain.FormShow(Sender: TObject);
|
||||||
@@ -509,21 +519,23 @@ begin
|
|||||||
stringPackageFiles.RowCount := JSONPackage.UpdatePackageFiles.Count + 1;
|
stringPackageFiles.RowCount := JSONPackage.UpdatePackageFiles.Count + 1;
|
||||||
for i := 0 to JSONPackage.UpdatePackageFiles.Count - 1 do
|
for i := 0 to JSONPackage.UpdatePackageFiles.Count - 1 do
|
||||||
begin
|
begin
|
||||||
stringPackageFiles.Cells[0, i + 1] := JSONPackage.UpdatePackageFiles.Items[i].Name;
|
stringPackageFiles.Cells[0, i + 1] :=
|
||||||
stringPackageFiles.Cells[1, i + 1] := JSONPackage.UpdatePackageFiles.Items[i].Version;
|
JSONPackage.UpdatePackageFiles.Items[i].Name;
|
||||||
|
stringPackageFiles.Cells[1, i + 1] :=
|
||||||
|
JSONPackage.UpdatePackageFiles.Items[i].Version;
|
||||||
|
end;
|
||||||
|
if ValidationFailed then
|
||||||
|
begin
|
||||||
|
if (slErrorList.Count > 1) then
|
||||||
|
ShowMessage(Format(rsUpdateJsonSF, [ExtractFileName(sJSONFilePath)]) +
|
||||||
|
LineEnding + LineEnding + rsOneOfTheReqn + LineEnding +
|
||||||
|
slErrorList.Text + LineEnding + rsFixThenTryAg)
|
||||||
|
else
|
||||||
|
ShowMessage(Format(rsUpdateJsonSF, [ExtractFileName(sJSONFilePath)]) +
|
||||||
|
LineEnding + LineEnding + rsOneOfTheReq1 + LineEnding +
|
||||||
|
slErrorList.Text + LineEnding + rsFixThenTryAg);
|
||||||
|
Exit;
|
||||||
end;
|
end;
|
||||||
if ValidationFailed then
|
|
||||||
begin
|
|
||||||
if (slErrorList.Count > 1) then
|
|
||||||
ShowMessage(Format(rsUpdateJsonSF, [ExtractFileName(sJSONFilePath)]) + LineEnding
|
|
||||||
+ LineEnding + rsOneOfTheReqn + LineEnding + slErrorList.Text +
|
|
||||||
LineEnding + rsFixThenTryAg)
|
|
||||||
else
|
|
||||||
ShowMessage(Format(rsUpdateJsonSF,[ExtractFileName(sJSONFilePath)]) + LineEnding
|
|
||||||
+ LineEnding + rsOneOfTheReq1 + LineEnding + slErrorList.Text +
|
|
||||||
LineEnding + rsFixThenTryAg);
|
|
||||||
Exit;
|
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ShowMessageFmt('There was a problem loading "%s" - is it corrupted or in the wrong format?',
|
ShowMessageFmt('There was a problem loading "%s" - is it corrupted or in the wrong format?',
|
||||||
@@ -573,8 +585,10 @@ begin
|
|||||||
s += RightStr(VInfo.VersionStrings[1], Length(VInfo.VersionStrings[1]) -
|
s += RightStr(VInfo.VersionStrings[1], Length(VInfo.VersionStrings[1]) -
|
||||||
EqualsPos) + LineEnding;
|
EqualsPos) + LineEnding;
|
||||||
end;
|
end;
|
||||||
|
{
|
||||||
s+=Format(rsCompiledWith2,
|
s+=Format(rsCompiledWith2,
|
||||||
[{$I %FPCVERSION%},lcl_major,lcl_minor,LineEnding,{$I %FPCTARGETCPU%},{$I %FPCTARGETOS%},LineEnding,LineEnding]);
|
[{$I %FPCVERSION%},lcl_major,lcl_minor,LineEnding,{$I %FPCTARGETCPU%},{$I %FPCTARGETOS%},LineEnding,LineEnding]);
|
||||||
|
}
|
||||||
if VInfo.VersionStrings.Count > 1 then
|
if VInfo.VersionStrings.Count > 1 then
|
||||||
begin
|
begin
|
||||||
EqualsPos := Pos('=', VInfo.VersionStrings[0]); // File Deswcription
|
EqualsPos := Pos('=', VInfo.VersionStrings[0]); // File Deswcription
|
||||||
@@ -614,7 +628,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
mnu_lang_en.Checked := False;
|
mnu_lang_en.Checked := False;
|
||||||
// SetDefaultLang(''); // Back to default?
|
// SetDefaultLang(''); // Back to default?
|
||||||
ShowMessage(rsSorryThisLan + LineEnding + rsYouMayNeedTo);
|
ShowMessage(rsSorryThisLan + LineEnding + rsYouMayNeedTo);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -673,8 +687,8 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
// A full URL?
|
// A full URL?
|
||||||
if ((Length(editDownloadZipURL.Text) > 0) and (RightStr(editDownloadZipURL.Text, 1) = '/'))
|
if ((Length(editDownloadZipURL.Text) > 0) and
|
||||||
then
|
(RightStr(editDownloadZipURL.Text, 1) = '/')) then
|
||||||
begin
|
begin
|
||||||
slErrorList.Add(rsDownloadZipURLI2);
|
slErrorList.Add(rsDownloadZipURLI2);
|
||||||
editDownloadZipURL.Color := clYellow;
|
editDownloadZipURL.Color := clYellow;
|
||||||
@@ -752,7 +766,8 @@ begin
|
|||||||
if bForceSaveAs or (sJSONFilePath = '') then
|
if bForceSaveAs or (sJSONFilePath = '') then
|
||||||
begin
|
begin
|
||||||
FileSaveAs1.Dialog.InitialDir := sUpdateDirectory;
|
FileSaveAs1.Dialog.InitialDir := sUpdateDirectory;
|
||||||
FileSaveAs1.Dialog.FileName := 'update_' + ExtractFilenameOnly(editName.Text) + '.json';
|
FileSaveAs1.Dialog.FileName :=
|
||||||
|
'update_' + ExtractFilenameOnly(editName.Text) + '.json';
|
||||||
if FileSaveAs1.Dialog.Execute then
|
if FileSaveAs1.Dialog.Execute then
|
||||||
sJSONFilePath := FileSaveAs1.Dialog.FileName
|
sJSONFilePath := FileSaveAs1.Dialog.FileName
|
||||||
else
|
else
|
||||||
@@ -897,39 +912,82 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF PO_RESOURCES}
|
|
||||||
// Use embedded .po resources if not distributed with executable
|
// Use embedded .po resources if not distributed with executable
|
||||||
Initialization
|
initialization
|
||||||
{$I translate.lrs}
|
sPoPath_en := ProgramDirectory + 'locale\' + ExtractFilenameOnly(
|
||||||
If NOT FileExistsUTF8(ProgramDirectory + 'locale\' + ExtractFilenameOnly(Application.EXEName) + '.es.po') then
|
Application.EXEName) + '.en.po';
|
||||||
BEGIN
|
sPoPath_es := ProgramDirectory + 'locale\' + ExtractFilenameOnly(
|
||||||
aLRes:=LazarusResources.Find('jsoneditor.es');
|
Application.EXEName) + '.es.po';
|
||||||
if assigned(aLRes) then
|
if (lcl_major > 0) and (lcl_minor > 6) then
|
||||||
begin
|
begin
|
||||||
ForceDirectory(ProgramDirectory + 'locale');
|
{$IFDEF PO_BUILTINRES}
|
||||||
aSS:=TStringListUTF8.Create;
|
// This uses a resource file added via Project/Options
|
||||||
TRY
|
if not FileExistsUTF8(sPoPath_en) then
|
||||||
Ass.Add(aLRes.Value);
|
begin
|
||||||
aSS.SaveToFile(ProgramDirectory + 'locale\' + ExtractFilenameOnly(Application.EXEName) + '.es.po');
|
// create a resource stream which points to the po file
|
||||||
Finally
|
S := TResourceStream.Create(HInstance, 'JSONEDITOR.EN', MakeIntResource(10));
|
||||||
aSS.Free;
|
try
|
||||||
|
ForceDirectory(ProgramDirectory + 'locale');
|
||||||
|
F := TFileStream.Create(sPoPath_en, fmCreate);
|
||||||
|
try
|
||||||
|
F.CopyFrom(S, S.Size); // copy data from the resource stream to file stream
|
||||||
|
finally
|
||||||
|
F.Free; // destroy the file stream
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
S.Free; // destroy the resource stream
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if not FileExistsUTF8(sPoPath_es) then
|
||||||
|
begin
|
||||||
|
S := TResourceStream.Create(HInstance, 'JSONEDITOR.ES', MakeIntResource(10));
|
||||||
|
try
|
||||||
|
ForceDirectory(ProgramDirectory + 'locale');
|
||||||
|
F := TFileStream.Create(sPoPath_es, fmCreate);
|
||||||
|
try
|
||||||
|
F.CopyFrom(S, S.Size);
|
||||||
|
finally
|
||||||
|
F.Free
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
S.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin // Older version of laz
|
||||||
|
// This uses an lrs file generated from lazres
|
||||||
|
{$I translate.lrs}
|
||||||
|
if not FileExistsUTF8(sPoPath_es) then
|
||||||
|
begin
|
||||||
|
aLRes := LazarusResources.Find('jsoneditor.es');
|
||||||
|
if assigned(aLRes) then
|
||||||
|
begin
|
||||||
|
ForceDirectory(ProgramDirectory + 'locale');
|
||||||
|
aSS := TStringListUTF8.Create;
|
||||||
|
try
|
||||||
|
Ass.Add(aLRes.Value);
|
||||||
|
aSS.SaveToFile(sPoPath_es);
|
||||||
|
finally
|
||||||
|
aSS.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if not FileExistsUTF8(sPoPath_en) then
|
||||||
|
begin
|
||||||
|
aLRes := LazarusResources.Find('jsoneditor.en');
|
||||||
|
if assigned(aLRes) then
|
||||||
|
begin
|
||||||
|
ForceDirectory(ProgramDirectory + 'locale');
|
||||||
|
aSS := TStringListUTF8.Create;
|
||||||
|
try
|
||||||
|
Ass.Add(aLRes.Value);
|
||||||
|
aSS.SaveToFile(sPoPath_en);
|
||||||
|
finally
|
||||||
|
aSS.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
END;
|
|
||||||
If NOT FileExistsUTF8(ProgramDirectory + 'locale\' + ExtractFilenameOnly(Application.EXEName) + '.en.po') then
|
|
||||||
BEGIN
|
|
||||||
aLRes:=LazarusResources.Find('jsoneditor.en');
|
|
||||||
if assigned(aLRes) then
|
|
||||||
begin
|
|
||||||
ForceDirectory(ProgramDirectory + 'locale');
|
|
||||||
aSS:=TStringListUTF8.Create;
|
|
||||||
TRY
|
|
||||||
Ass.Add(aLRes.Value);
|
|
||||||
aSS.SaveToFile(ProgramDirectory + 'locale\' + ExtractFilenameOnly(Application.EXEName) + '.en.po');
|
|
||||||
FINALLY
|
|
||||||
aSS.Free;
|
|
||||||
END;
|
|
||||||
end;
|
|
||||||
END;
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user