yktoo / dklang Goto Github PK
View Code? Open in Web Editor NEWDKLang Localization Package
DKLang Localization Package
DKLang Localization Package =========================== DKLang Localization Package is a set of classes intended to simplify the localization of applications written in Delphi. At Version 5.0 DKLang Localization Package has been rewritten to work on all current (XE5) platforms: VCL (win32 & win64) & FireMonkey (win32, win64, OSX, Android & iOS). For details see http://yktoo.com/software/dklang and read the wiki.
I was able to install v 5.0 in Delphi XE6 with no problem, but when I define some constants (using the Project Editor option), when I run the application, I get an error message like: Project xxx.exe raised exception class EDKLangError with message 'Invalid constant name (lots of weird non-ascii chars here)'.
Is there any chance to have a XE8 compatible version?
Specifically for 32&64 iOS….
Thanks !
For example, how do I translate the text in the following code, they are not static and not use in xxx.Caption
// translate "this is number"
result := format('this is number %d',[number]);
var
s:string;
begin
// translate "This is number" "please check it"
s := 'This is number' + inttostr(num) + 'please check it';
// translate "this is message"
showmessage("this is message");
I didn't find any examples in the demo, thanks!
Not all projects are written with interface in US English. My suggestion is that the DefaultLanguageID should be a published property.
Also, in spite of the fact that actually I can set the DefaultLanguageID to something different from the US_EN in the form.oncreate, doing so causes side-effects when you try to change the language in runtime, ie: you need to change the language twice for the first time to actually take some effect in the application interface.
Update: To solve the problem mentioned in the second paragraph, it is needed to set the LanguageId property after changing the DefaultLanguageID in the form.oncreate.
When IDE load dklang.dpoj and compile it, compile error occured.
{$I LibSuffix.inc} do not work in IDE(XE5)
so I remove it in dklang.dpk then compile success
Delphi reports "An unexpected memory leak", 1xTMemoryStream
after adding translations to TDKLTranslationStorage.
Reporting enabled by ReportMemoryLeaksOnShutdown := True;
I want to add my constant inside the .dkl_const.res using a custom function.
What i want it's create a custom function where if the constant it's not fund, i can had it inside the .res.
And don't use the "Project->Edit project constants"
I have fund this functions :
I have try to use it but i don't know what i need to use in argument.
Ty
Ghortes
P.S. : Sorry for my bad English, it's not my native tongue
When writing the constants to the resource (*.dkl_consts) and *.dklang files, they are not being written in alphabetical order. This has changed since moving from version 4.x to the new v5
Removing v5.2 and installing v4.01 resolves the issue, but would prefer to use the newer version of course. Tested using Delphi XE6
Dklang is compatible with delphi 10.2.1 ?
i have a link error ( target ios11 )
duplicate symbol ___rsrc_N6RCDATA13dklang_constsE in:
Formain.o
[DCC Erreur fatale] F2588 Code d'erreur du lieur : 1 ($00000001)
And for windows 32 bits it's ok ( not for 64 )
FireDAC components include a string property "BaseDriverID" that is read only. Writing to the property throws an unhandled exception.
A work around is to add "*.BaseDriverID" to the IgnoreList property of the TDKLanguageController.
Corrected 2013.12.07 at v4.01 by adding tests to exclude read-only properties.
It's great to see this neat library alive again!
I'd like to see support for XE4, if you guy can't do that, I probably will be able to contribute if it's not that hard, when my project get to the point where it needs DKLang.
Constants are being corrupted after a save from editor.
Firemonkey allows to add views to multi-device projects
http://docwiki.embarcadero.com/RADStudio/XE8/en/Adding_Views_to_Your_Multi-Device_Project
If you add view for a form then additional directive will appear in the code:
TMyForm = class(TForm)
....
end;
implementation
{$R *.fmx}
{$R *.LgXhdpiTb.fmx ANDROID} // view
After that the form won't be translated if added view is in use.
The problem is in incorrect Controller.ActualSectionName
. It has value MyForm_LgXhdpiTb
insted of MyForm
. As result, follow code
Translations.FindComponentName(Controller.ActualSectionName);
in function
TDKLanguageManager.ApplyTranToController
returns nil... and translation is not made.
Hello!
I use the version 4 of your DKLang component for Delphi XE2. I put on every form the DKLanguageControlle and name it "DKLanguageController". Every element caption or text is written in english. So i use your Translation Manager and create a new "German.lang" file.
I start my program and switch to german language. The main form changes and every element is in german, but now i open a other form by ShowModal(). The elements are not translated, but the used constraints (for grid title and messages) works.
In some ShowModal() dialogs does the translation work and other dialogs doesnt work. I dont know why.
I call the dialogs by follow code:
begin
pntCardRarity := TfrmCardRarityDialog.Create(Self, fDebug);
try
pntCardRarity.fpntDatabase := dbeDatabase;
pntCardRarity.ShowModal;
finally
pntCardRarity.Release;
end;
I try to recreated the whole DKLang and lang file, but that doesnt work. The DKLang file:
I am trying to make one Android app with DKLang(truely the best component) for Unicode language. Language Id is 2117 (Bangla). In Windows all text property and constant are showing properly but in Android it's not showing properly. Please check screenshot.
For windows: http://prntscr.com/krrfvd
For Android: http://prntscr.com/krrgik
I am using Delphi Tokyo 10.2.3
Hi, missing constants are annoying.
But not being able to figure out which one is missing is even more annoying.
That's why I made this adjustment in DKLang.pas :
class function TDKLanguageManager.GetConstantValue(const wsName: UnicodeString): UnicodeString;
var
l_Value : PDKLang_Constant;
begin
FSynchronizer.BeginRead;
try
// Result := FConstants.GetValues(wsName); // original code
if FConstants.TryGetValue(wsName, l_Value) // my replacement
then Result := l_Value.wsValue
else Result := '"' + wsName + '"';
finally
FSynchronizer.EndRead;
end;
end;
Maybe this may usefull for others also.
I am using version 5.2 with Delphi XE4 and it works well with standard VCL projects/forms.
Problem is when I try to use LanguageController on IntraWeb forms = TIWAppForm, IDE reports error when component tries to update language source files. (put LanguageController on IntraWeb form and try to save that form)
Any idea where and how to customize LanguageController to work with TIWAppForm ?
Designtime IDE error:
[5012742F]{rtl180.bpl } System.TypInfo.{System.TypInfo}TPropSet<System.string>.GetProc (Line 2221, "System.TypInfo.pas" + 8) + $6
[50125B2D]{rtl180.bpl } System.TypInfo.GetStrProp (Line 3068, "System.TypInfo.pas" + 7) + $A
[1348BFB4]{dklang.bpl } Dklang.TDKLang_CompEntry.GetName + $458
[1348C0A4]{dklang.bpl } Dklang.TDKLang_CompEntry.GetName + $548
[1348C0E3]{dklang.bpl } Dklang.TDKLang_CompEntry.GetName + $587
[1348C2A8]{dklang.bpl } Dklang.TDKLang_CompEntry.InternalUpdateEntries + $44
[1348C24C]{dklang.bpl } Dklang.TDKLang_CompEntry.GetName + $6F0
[1348C2AF]{dklang.bpl } Dklang.TDKLang_CompEntry.InternalUpdateEntries + $4B
[1348C741]{dklang.bpl } Dklang.TDKLang_CompEntry.UpdateEntries + $4D
[1348D7F3]{dklang.bpl } Dklang.TDKLanguageController.UpdateComponents + $83
[1348D6BE]{dklang.bpl } Dklang.TDKLanguageController.LSO_CanStore + $32
[134899E8]{dklang.bpl } Dklang.UpdateLangSourceStrings + $3C
[5005EA34]{rtl180.bpl } System.TObject.FreeInstance (Line 15183, "System.pas" + 2) + $2
[5005F286]{rtl180.bpl } System.@ClassDestroy (Line 16528, "System.pas" + 0) + $2
[5005EB34]{rtl180.bpl } System.TObject.Free (Line 15251, "System.pas" + 1) + $4
[50155F9A]{rtl180.bpl } System.Classes.TStrings.LoadFromFile (Line 6035, "System.Classes.pas" + 5) + $3
[13489C25]{dklang.bpl } Dklang.UpdateLangSourceFile + $65
[134470B8]{dcldklang.bpl} Dkl_expt._SDKLExptMenuItem_UpdateLangSource + $D8
[1344717E]{dcldklang.bpl} Dkl_expt._SDKLExptMenuItem_UpdateLangSource + $19E
[134478FF]{dcldklang.bpl} Dkl_expt._SDKLExptMenuItem_UpdateLangSource + $91F
[2114EB01]{designide180.bpl} ComponentDesigner.TOTAFormEditor.NotifyFormSaving (Line 7747, "ComponentDesigner.pas" + 2) + $5
[21129C91]{designide180.bpl} ToolUtils.ForEach (Line 99, "ToolUtils.pas" + 5) + $F
[2114E5D3]{designide180.bpl} ComponentDesigner.TOTAFormEditor.FormSaving (Line 7597, "ComponentDesigner.pas" + 0) + $B
[21141295]{designide180.bpl} ComponentDesigner.TComponentRoot.GetRootStream (Line 2807, "ComponentDesigner.pas" + 7) + $A
[211465A6]{designide180.bpl} ComponentDesigner.TComponentRoot.Save (Line 4800, "ComponentDesigner.pas" + 1) + $2
[21D57167]{delphicoreide180.bpl} DelphiModule.TPascalCodeMgrModHandler.SaveFile (Line 1541, "DelphiModule.pas" + 2) + $8
[206DC0EC]{coreide180.bpl} SourceModule.TCodeISourceModule.SaveFile (Line 1508, "SourceModule.pas" + 2) + $1E
[206D96CC]{coreide180.bpl} SourceModule.TSourceModule.SaveFile (Line 653, "SourceModule.pas" + 3) + $1B
[20868B2B]{coreide180.bpl} DocModul.TDocModule.TheMalteseFalcon (Line 1431, "DocModul.pas" + 59) + $C
[500F4279]{rtl180.bpl } System.Rtti.RawInvoke (Line 7020, "System.Rtti.pas" + 46) + $0
[500F464F]{rtl180.bpl } System.Rtti.Invoke (Line 7215, "System.Rtti.pas" + 57) + $6
[500EAE1C]{rtl180.bpl } System.Rtti.TRttiInstanceMethodEx.DispatchInvoke (Line 5347, "System.Rtti.pas" + 101) + $20
[500F4ACC]{rtl180.bpl } System.Rtti.TRttiMethod.Invoke (Line 7835, "System.Rtti.pas" + 1) + $11
[208687AC]{coreide180.bpl} DocModul.TDocModule.Save (Line 1356, "DocModul.pas" + 3) + $1E
[206DA8B5]{coreide180.bpl} SourceModule.TSourceModule.Save (Line 1002, "SourceModule.pas" + 13) + $3
[505E0F4B]{vcl180.bpl } Vcl.AppEvnts.TMultiCaster.GetAppEvents (Line 654, "Vcl.AppEvnts.pas" + 1) + $9
[505E0822]{vcl180.bpl } Vcl.AppEvnts.TMultiCaster.DoActionExecute (Line 390, "Vcl.AppEvnts.pas" + 5) + $E
[0041FBE6]{bds.exe } Sanctuary.LicenseFileHelper. + $0
[5016F37F]{rtl180.bpl } System.Classes.TBasicAction.Execute (Line 16354, "System.Classes.pas" + 3) + $7
[5043C277]{vcl180.bpl } Vcl.ActnList.TCustomAction.Execute (Line 284, "Vcl.ActnList.pas" + 19) + $35
[0B6A23FA]{IDEFixPack.dll} RefactoringActionUpdateFix.CustomActionExecute + $22
[5016F21F]{rtl180.bpl } System.Classes.TBasicActionLink.Execute (Line 16270, "System.Classes.pas" + 2) + $7
[50453038]{vcl180.bpl } Vcl.Controls.TControl.Click (Line 7338, "Vcl.Controls.pas" + 7) + $7
[504CF210]{vcl180.bpl } Vcl.ComCtrls.TToolButton.Click (Line 21439, "Vcl.ComCtrls.pas" + 0) + $0
[504534F9]{vcl180.bpl } Vcl.Controls.TControl.WMLButtonUp (Line 7479, "Vcl.Controls.pas" + 7) + $6
[50452AF9]{vcl180.bpl } Vcl.Controls.TControl.WndProc (Line 7224, "Vcl.Controls.pas" + 91) + $6
[505801E3]{vcl180.bpl } Vcl.Forms.TApplication.WndProc (Line 9857, "Vcl.Forms.pas" + 98) + $B
[21101D7A]{designide180.bpl} DeskUtil.SetFocusHook (Line 463, "DeskUtil.pas" + 4) + $C
[50452734]{vcl180.bpl } Vcl.Controls.TControl.Perform (Line 7002, "Vcl.Controls.pas" + 10) + $8
[50456CF0]{vcl180.bpl } Vcl.Controls.GetControlAtPos (Line 9774, "Vcl.Controls.pas" + 4) + $76
[50456DBA]{vcl180.bpl } Vcl.Controls.TWinControl.ControlAtPos (Line 9797, "Vcl.Controls.pas" + 13) + $E
[50452734]{vcl180.bpl } Vcl.Controls.TControl.Perform (Line 7002, "Vcl.Controls.pas" + 10) + $8
[50456E84]{vcl180.bpl } Vcl.Controls.TWinControl.IsControlMouseMsg (Line 9821, "Vcl.Controls.pas" + 15) + $2A
[50457431]{vcl180.bpl } Vcl.Controls.TWinControl.WndProc (Line 9990, "Vcl.Controls.pas" + 104) + $6
[504D1371]{vcl180.bpl } Vcl.ComCtrls.TToolBar.UpdateButtonState (Line 22722, "Vcl.ComCtrls.pas" + 11) + $27
[504D13B2]{vcl180.bpl } Vcl.ComCtrls.TToolBar.UpdateButtonStates (Line 22733, "Vcl.ComCtrls.pas" + 3) + $4
[504D3D38]{vcl180.bpl } Vcl.ComCtrls.TToolBar.WndProc (Line 24308, "Vcl.ComCtrls.pas" + 104) + $6
[50456BF8]{vcl180.bpl } Vcl.Controls.TWinControl.MainWndProc (Line 9751, "Vcl.Controls.pas" + 3) + $6
[50170090]{rtl180.bpl } System.Classes.StdWndProc (Line 16860, "System.Classes.pas" + 8) + $0
[50582213]{vcl180.bpl } Vcl.Forms.TApplication.CancelHint (Line 11117, "Vcl.Forms.pas" + 6) + $E
[50580E87]{vcl180.bpl } Vcl.Forms.TApplication.ProcessMessage (Line 10288, "Vcl.Forms.pas" + 23) + $1
[50580ECA]{vcl180.bpl } Vcl.Forms.TApplication.HandleMessage (Line 10318, "Vcl.Forms.pas" + 1) + $4
[50581205]{vcl180.bpl } Vcl.Forms.TApplication.Run (Line 10456, "Vcl.Forms.pas" + 26) + $3
Duplicate case label compile error occured in XE5 IDE
case label must be UNICODE since Delphi 2009.
but, #161 is ASCII label ^^
pls change to #$161
I have just updated to Delphi 11 and find that opening the "DKLang - Edit project constants..." menu item is now causing a "Range check error".
I'm not sure that I have the skill set to fix this. I did try to create a separate project that just ran the editor. It starts OK but gave an AV on FConsts.Clear; in bOKClick().
Any help would be much appreciated!
There is follow problem in fmx project under XE8.
There are two forms in the project.
First form contains DKLTranslationsStorage instance.
First form creates second form and opens it.
Second form is not translated.
It looks like the problem is in DKLang.pas, line 1202.
It's necessary to add follow code there:
Stream.Seek(0, TSeekOrigin.soBeginning);
then problem disappear.
How i can compile DKLang v.5 in CBuilder XE5?
If i compile it in Delphi XE5, IDE not found it in CBuilder projects.
I have created 2 projects:
-runtime (dklang_rtl) with files: DKLang.pas, DKLangStorage.pas, DKL_LanguageCodes.pas
-designtime (dklang_dsn) with files: DKL_ResFile.pas, DKL_Expt.pas, DKL_ConstEditor.pas, DKLangReg.pas, DKL_StorageEditor.pas
Runtime package compiled properly, But designtime package report:
[DCC Fatal Error] DKL_Expt.pas(34): F1026 File not found: 'ToolsAPI.dcu'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.