mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 21:00:43 +02:00
Move Translations unit from LCL to LazUtils.
git-svn-id: trunk@53740 -
This commit is contained in:
parent
b1a91e3d7c
commit
2329f266ed
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -3086,6 +3086,7 @@ components/lazutils/test/TestLazStorageMem.lpi svneol=native#text/plain
|
||||
components/lazutils/test/TestLazStorageMem.lpr svneol=native#text/plain
|
||||
components/lazutils/test/testlazstoragememcase1.pas svneol=native#text/plain
|
||||
components/lazutils/textstrings.pas svneol=native#text/pascal
|
||||
components/lazutils/translations.pas svneol=native#text/pascal
|
||||
components/lazutils/ttcache.pas svneol=native#text/pascal
|
||||
components/lazutils/ttcalc.pas svneol=native#text/pascal
|
||||
components/lazutils/ttcalc1.inc svneol=native#text/pascal
|
||||
@ -7990,7 +7991,6 @@ lcl/tests/test6_1masks.lpr svneol=native#text/plain
|
||||
lcl/themes.pas svneol=native#text/pascal
|
||||
lcl/tmschema.pas svneol=native#text/pascal
|
||||
lcl/toolwin.pp svneol=native#text/pascal
|
||||
lcl/translations.pas svneol=native#text/pascal
|
||||
lcl/update_allunits.lpi svneol=native#text/plain
|
||||
lcl/update_allunits.lpr svneol=native#text/plain
|
||||
lcl/utrace.pp svneol=native#text/pascal
|
||||
|
@ -27,6 +27,7 @@ function DbgStr(const StringWithSpecialChars: string): string; overload;
|
||||
function DbgStr(const StringWithSpecialChars: string; StartPos, Len: PtrInt): string; overload;
|
||||
function DbgStr(const p: PChar; Len: PtrInt): string; overload;
|
||||
function DbgWideStr(const StringWithSpecialChars: widestring): string; overload;
|
||||
procedure DumpExceptionBackTrace;
|
||||
|
||||
function ConvertLineEndings(const s: string): string;
|
||||
procedure ReplaceSubstring(var s: string; StartPos, Count: SizeInt;
|
||||
@ -765,6 +766,30 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DumpAddr(Addr: Pointer);
|
||||
begin
|
||||
// preventing another exception, while dumping stack trace
|
||||
try
|
||||
DebugLn(BackTraceStrFunc(Addr));
|
||||
except
|
||||
DebugLn(SysBackTraceStr(Addr));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DumpExceptionBackTrace;
|
||||
var
|
||||
FrameCount: integer;
|
||||
Frames: PPointer;
|
||||
FrameNumber:Integer;
|
||||
begin
|
||||
DebugLn(' Stack trace:');
|
||||
DumpAddr(ExceptAddr);
|
||||
FrameCount:=ExceptFrameCount;
|
||||
Frames:=ExceptFrames;
|
||||
for FrameNumber := 0 to FrameCount-1 do
|
||||
DumpAddr(Frames[FrameNumber]);
|
||||
end;
|
||||
|
||||
function ConvertLineEndings(const s: string): string;
|
||||
var
|
||||
i: Integer;
|
||||
|
@ -16,7 +16,7 @@
|
||||
<Description Value="Useful units for Lazarus packages."/>
|
||||
<License Value="Modified LGPL-2"/>
|
||||
<Version Major="1"/>
|
||||
<Files Count="89">
|
||||
<Files Count="90">
|
||||
<Item1>
|
||||
<Filename Value="LazLoggerImpl.inc"/>
|
||||
<Type Value="Include"/>
|
||||
@ -262,117 +262,121 @@
|
||||
<UnitName Value="TextStrings"/>
|
||||
</Item61>
|
||||
<Item62>
|
||||
<Filename Value="ttcache.pas"/>
|
||||
<UnitName Value="TTCache"/>
|
||||
<Filename Value="translations.pas"/>
|
||||
<UnitName Value="Translations"/>
|
||||
</Item62>
|
||||
<Item63>
|
||||
<Filename Value="ttcalc.pas"/>
|
||||
<UnitName Value="TTCalc"/>
|
||||
<Filename Value="ttcache.pas"/>
|
||||
<UnitName Value="TTCache"/>
|
||||
</Item63>
|
||||
<Item64>
|
||||
<Filename Value="ttcalc1.inc"/>
|
||||
<Type Value="Include"/>
|
||||
<Filename Value="ttcalc.pas"/>
|
||||
<UnitName Value="TTCalc"/>
|
||||
</Item64>
|
||||
<Item65>
|
||||
<Filename Value="ttcalc2.inc"/>
|
||||
<Filename Value="ttcalc1.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item65>
|
||||
<Item66>
|
||||
<Filename Value="ttcalc3.inc"/>
|
||||
<Filename Value="ttcalc2.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item66>
|
||||
<Item67>
|
||||
<Filename Value="ttcalc4.inc"/>
|
||||
<Filename Value="ttcalc3.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item67>
|
||||
<Item68>
|
||||
<Filename Value="ttcmap.pas"/>
|
||||
<UnitName Value="TTCMap"/>
|
||||
<Filename Value="ttcalc4.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item68>
|
||||
<Item69>
|
||||
<Filename Value="ttconfig.inc"/>
|
||||
<Type Value="Include"/>
|
||||
<Filename Value="ttcmap.pas"/>
|
||||
<UnitName Value="TTCMap"/>
|
||||
</Item69>
|
||||
<Item70>
|
||||
<Filename Value="ttdebug.pas"/>
|
||||
<UnitName Value="TTDebug"/>
|
||||
<Filename Value="ttconfig.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item70>
|
||||
<Item71>
|
||||
<Filename Value="tterror.pas"/>
|
||||
<UnitName Value="TTError"/>
|
||||
<Filename Value="ttdebug.pas"/>
|
||||
<UnitName Value="TTDebug"/>
|
||||
</Item71>
|
||||
<Item72>
|
||||
<Filename Value="ttfile.pas"/>
|
||||
<UnitName Value="TTFile"/>
|
||||
<Filename Value="tterror.pas"/>
|
||||
<UnitName Value="TTError"/>
|
||||
</Item72>
|
||||
<Item73>
|
||||
<Filename Value="ttgload.pas"/>
|
||||
<UnitName Value="TTGLoad"/>
|
||||
<Filename Value="ttfile.pas"/>
|
||||
<UnitName Value="TTFile"/>
|
||||
</Item73>
|
||||
<Item74>
|
||||
<Filename Value="ttinterp.pas"/>
|
||||
<UnitName Value="TTInterp"/>
|
||||
<Filename Value="ttgload.pas"/>
|
||||
<UnitName Value="TTGLoad"/>
|
||||
</Item74>
|
||||
<Item75>
|
||||
<Filename Value="ttload.pas"/>
|
||||
<UnitName Value="TTLoad"/>
|
||||
<Filename Value="ttinterp.pas"/>
|
||||
<UnitName Value="TTInterp"/>
|
||||
</Item75>
|
||||
<Item76>
|
||||
<Filename Value="ttmemory.pas"/>
|
||||
<UnitName Value="TTMemory"/>
|
||||
<Filename Value="ttload.pas"/>
|
||||
<UnitName Value="TTLoad"/>
|
||||
</Item76>
|
||||
<Item77>
|
||||
<Filename Value="ttobjs.pas"/>
|
||||
<UnitName Value="TTObjs"/>
|
||||
<Filename Value="ttmemory.pas"/>
|
||||
<UnitName Value="TTMemory"/>
|
||||
</Item77>
|
||||
<Item78>
|
||||
<Filename Value="ttprofile.pas"/>
|
||||
<UnitName Value="TTProfile"/>
|
||||
<Filename Value="ttobjs.pas"/>
|
||||
<UnitName Value="TTObjs"/>
|
||||
</Item78>
|
||||
<Item79>
|
||||
<Filename Value="ttraster.pas"/>
|
||||
<UnitName Value="TTRASTER"/>
|
||||
<Filename Value="ttprofile.pas"/>
|
||||
<UnitName Value="TTProfile"/>
|
||||
</Item79>
|
||||
<Item80>
|
||||
<Filename Value="ttraster_sweep.inc"/>
|
||||
<Type Value="Include"/>
|
||||
<Filename Value="ttraster.pas"/>
|
||||
<UnitName Value="TTRASTER"/>
|
||||
</Item80>
|
||||
<Item81>
|
||||
<Filename Value="tttables.pas"/>
|
||||
<UnitName Value="TTTables"/>
|
||||
<Filename Value="ttraster_sweep.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item81>
|
||||
<Item82>
|
||||
<Filename Value="tttypes.pas"/>
|
||||
<UnitName Value="TTTypes"/>
|
||||
<Filename Value="tttables.pas"/>
|
||||
<UnitName Value="TTTables"/>
|
||||
</Item82>
|
||||
<Item83>
|
||||
<Filename Value="unixfileutil.inc"/>
|
||||
<Type Value="Include"/>
|
||||
<Filename Value="tttypes.pas"/>
|
||||
<UnitName Value="TTTypes"/>
|
||||
</Item83>
|
||||
<Item84>
|
||||
<Filename Value="unixlazfileutils.inc"/>
|
||||
<Filename Value="unixfileutil.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item84>
|
||||
<Item85>
|
||||
<Filename Value="unixlazutf8.inc"/>
|
||||
<Filename Value="unixlazfileutils.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item85>
|
||||
<Item86>
|
||||
<Filename Value="utf8process.pp"/>
|
||||
<UnitName Value="UTF8Process"/>
|
||||
<Filename Value="unixlazutf8.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item86>
|
||||
<Item87>
|
||||
<Filename Value="winfileutil.inc"/>
|
||||
<Type Value="Include"/>
|
||||
<Filename Value="utf8process.pp"/>
|
||||
<UnitName Value="UTF8Process"/>
|
||||
</Item87>
|
||||
<Item88>
|
||||
<Filename Value="winlazfileutils.inc"/>
|
||||
<Filename Value="winfileutil.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item88>
|
||||
<Item89>
|
||||
<Filename Value="winlazutf8.inc"/>
|
||||
<Filename Value="winlazfileutils.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item89>
|
||||
<Item90>
|
||||
<Filename Value="winlazutf8.inc"/>
|
||||
<Type Value="Include"/>
|
||||
</Item90>
|
||||
</Files>
|
||||
<LazDoc Paths="../../docs/xml/lazutils"/>
|
||||
<i18n>
|
||||
|
@ -18,9 +18,9 @@ uses
|
||||
LazLoggerProfiling, LazMethodList, LazUnicode, LazUTF16, LazUTF8,
|
||||
LazUTF8Classes, LazUTF8SysUtils, LazUtilities, LazUtilsStrConsts,
|
||||
LConvEncoding, lcsvutils, LookupStringList, Maps, Masks, PasWString,
|
||||
StringHashList, TextStrings, TTCache, TTCalc, TTCMap, TTDebug, TTError,
|
||||
TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile, TTRASTER,
|
||||
TTTables, TTTypes, UTF8Process, LazarusPackageIntf;
|
||||
StringHashList, TextStrings, Translations, TTCache, TTCalc, TTCMap, TTDebug,
|
||||
TTError, TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile,
|
||||
TTRASTER, TTTables, TTTypes, UTF8Process, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -81,17 +81,13 @@ unit Translations;
|
||||
|
||||
{$mode objfpc}{$H+}{$INLINE ON}
|
||||
|
||||
{$include include/lcl_defines.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
{$IF FPC_FULLVERSION>=30001}jsonscanner,{$ENDIF} jsonparser, fpjson,
|
||||
// LCL
|
||||
LCLProc,
|
||||
// LazUtils
|
||||
FileUtil, LazFileUtils, LazUTF8, LazUTF8Classes, LConvEncoding,
|
||||
FileUtil, LazFileUtils, LazUTF8, LazUTF8Classes, LConvEncoding, LazLogger,
|
||||
AvgLvlTree, StringHashList;
|
||||
|
||||
type
|
||||
@ -613,7 +609,7 @@ begin
|
||||
Result:=true;
|
||||
except
|
||||
on e: Exception do begin
|
||||
{$IFNDEF DisableChecks}
|
||||
{$IFnDEF DisableChecks}
|
||||
DebugLn('Exception while translating ', ResUnitName);
|
||||
DebugLn(e.Message);
|
||||
DumpExceptionBackTrace;
|
||||
@ -648,7 +644,7 @@ begin
|
||||
Result:=true;
|
||||
except
|
||||
on e: Exception do begin
|
||||
{$IFNDEF DisableChecks}
|
||||
{$IFnDEF DisableChecks}
|
||||
DebugLn('Exception while translating:');
|
||||
DebugLn(e.Message);
|
||||
DumpExceptionBackTrace;
|
||||
@ -1168,7 +1164,8 @@ begin
|
||||
{$ENDIF}
|
||||
then begin
|
||||
Result:=Item.Translation;
|
||||
if Result='' then RaiseGDBException('TPOFile.Translate Inconsistency');
|
||||
if Result='' then
|
||||
Raise Exception.Create('TPOFile.Translate Inconsistency');
|
||||
end else
|
||||
Result:=OriginalValue;
|
||||
//Remove lineending at the end of the string if present.
|
||||
@ -1211,7 +1208,7 @@ begin
|
||||
DebugLn('Entries:');
|
||||
DebugLn('---------------------------------------------');
|
||||
for i:=0 to FItems.Count-1 do begin
|
||||
DebugLn('#',dbgs(i),': ');
|
||||
DebugLn(['#', i ,': ']);
|
||||
Item := TPOFileItem(FItems[i]);
|
||||
DebugLn('Comments=',Item.Comments);
|
||||
DebugLn('Identifier=',Item.IdentifierLow);
|
||||
@ -1253,10 +1250,10 @@ begin
|
||||
if (StopIndex > Count - 1) then StopIndex := Count - 1;
|
||||
if (StartIndex < 0) then StartIndex := 0;
|
||||
|
||||
DebugLn('Entries [',DbgS(StartIndex),'..',Dbgs(StopIndex),']:');
|
||||
DebugLn(['Entries [', StartIndex, '..', StopIndex, ']:']);
|
||||
DebugLn('---------------------------------------------');
|
||||
for i := StartIndex to StopIndex do begin
|
||||
DebugLn('#',dbgs(i),': ');
|
||||
DebugLn(['#', i, ': ']);
|
||||
Item := TPOFileItem(FItems[i]);
|
||||
DebugLn('Identifier=',Item.IdentifierLow);
|
||||
DebugLn('msgid=',Item.Original);
|
||||
@ -1297,10 +1294,10 @@ begin
|
||||
if (StopIndex > Count - 1) then StopIndex := Count - 1;
|
||||
if (StartIndex < 0) then StartIndex := 0;
|
||||
|
||||
Log.Add('Entries ['+DbgS(StartIndex)+'..'+Dbgs(StopIndex)+']:');
|
||||
Log.Add(Format('Entries [%d..%d]:', [StartIndex, StopIndex]));
|
||||
Log.Add('---------------------------------------------');
|
||||
for i := StartIndex to StopIndex do begin
|
||||
Log.Add('#'+dbgs(i)+': ');
|
||||
Log.Add(Format('#%d: ', [i]));
|
||||
Item := TPOFileItem(FItems[i]);
|
||||
Log.Add('Identifier='+Item.IdentifierLow);
|
||||
Log.Add('msgid='+Item.Original);
|
||||
@ -1819,18 +1816,14 @@ var
|
||||
begin
|
||||
F := TStringList.Create;
|
||||
try
|
||||
|
||||
F.CommaText := Flags;
|
||||
i := F.IndexOf(AFlag);
|
||||
|
||||
if (i<0) and Check then
|
||||
F.Add(AFlag)
|
||||
else
|
||||
if (i>=0) and (not Check) then
|
||||
F.Delete(i);
|
||||
|
||||
Flags := F.CommaText;
|
||||
|
||||
finally
|
||||
F.Free;
|
||||
end;
|
@ -17,13 +17,13 @@ uses
|
||||
LCLStrConsts, LCLType, Menus, LCLUnicodeData, LCLVersion, LMessages,
|
||||
LResources, MaskEdit, PairSplitter, PopupNotifier, PostScriptCanvas,
|
||||
PostScriptPrinter, PostScriptUnicode, Printers, PropertyStorage, RubberBand,
|
||||
ShellCtrls, Spin, StdActns, StdCtrls, Themes, TmSchema, Toolwin,
|
||||
Translations, UTrace, XMLPropStorage, TimePopup, Messages, WSButtons,
|
||||
WSCalendar, WSCheckLst, WSComCtrls, WSControls, WSDesigner, WSDialogs,
|
||||
WSExtCtrls, WSExtDlgs, WSFactory, WSForms, WSGrids, WSImgList, WSLCLClasses,
|
||||
WSMenus, WSPairSplitter, WSProc, WSReferences, WSSpin, WSStdCtrls,
|
||||
WSToolwin, ActnList, AsyncProcess, ButtonPanel, Buttons, Calendar,
|
||||
RegisterLCL, ValEdit, LazCanvas, LazDialogs, LazRegions, CustomDrawn_Common,
|
||||
ShellCtrls, Spin, StdActns, StdCtrls, Themes, TmSchema, Toolwin, UTrace,
|
||||
XMLPropStorage, TimePopup, Messages, WSButtons, WSCalendar, WSCheckLst,
|
||||
WSComCtrls, WSControls, WSDesigner, WSDialogs, WSExtCtrls, WSExtDlgs,
|
||||
WSFactory, WSForms, WSGrids, WSImgList, WSLCLClasses, WSMenus,
|
||||
WSPairSplitter, WSProc, WSReferences, WSSpin, WSStdCtrls, WSToolwin,
|
||||
ActnList, AsyncProcess, ButtonPanel, Buttons, Calendar, RegisterLCL,
|
||||
ValEdit, LazCanvas, LazDialogs, LazRegions, CustomDrawn_Common,
|
||||
CustomDrawnControls, CustomDrawnDrawers, LazDeviceApis, LDockTree,
|
||||
LazFreeTypeIntfDrawer, CustomDrawn_WinXP, CustomDrawn_Android, Arrow,
|
||||
EditBtn, ComboEx, DBExtCtrls, CustomDrawn_Mac, CalcForm, LCLTranslator,
|
||||
|
576
lcl/lclbase.lpk
576
lcl/lclbase.lpk
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user