在丹麦,我正在使用DevExpress创建一个应用程序。但是我需要本地化DevExpress控件才能说丹麦语。但在我去工作和翻译之前,我想知道是否有人已经做过了。我使用cxLocalizerEditor创建带有翻译的.ini文件。
丹麦语翻译已经存在了吗?
有人可以使用自定义资源字符串的本地化吗?我不能让它起作用。
帮助中的示例如下所示。但我根本不能让它起作用。使用cxLocalization,dxCore,cxClasses;
type
TForm1 = class(TForm, IdxLocalizerListener)
cxLocalizer1: TcxLocalizer;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
// ...
public
procedure TranslationChanged;
end;
// ...
procedure TForm1.Create(AOwner: TComponent);
begin
dxResourceStringsRepository.AddListener(Self);
inherited Create(AOwner);
end;
procedure TForm1.Destroy;
begin
dxResourceStringsRepository.RemoveListener(Self);
inherited;
end;
procedure TForm1.TranslationChanged;
begin
Caption := cxGetResourceString(@sAppName);
// ...
end;但我能做的是:(cxLanguage是我使用定位器UI用自定义资源字符串创建的单元,@sHpDbSettingsCaption只是一个随机资源字符串)
unit Unit1;
interface
uses
cxLocalization, dxCore, cxClasses, cxLanguage,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm, IdxLocalizerListener)
procedure FormShow(Sender: TObject);
private
public
procedure TranslationChanged;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
begin
TranslationChanged;
end;
procedure TForm1.TranslationChanged;
begin
Caption := cxGetResourceString(@sHpDbSettingsCaption);
end;
end.发布于 2012-03-28 08:29:02
我没有使用cxLocalizerEditor,但是对于ResourceString,我创建了一个常量单元来使用cxSetResourceString进行翻译,它可以工作。
unit craDevExpressConsts;
interface
uses
Classes,
cxClasses,
sysutils;
//GetDevExpressResourceString changed in ChangeResourceStrings
procedure ChangeResourceStrings;
implementation
uses
cxFilterConsts,
cxFilterControlStrs,
cxEditConsts,
cxGridStrs;
procedure ChangeResourceStrings;
begin
//================================
// cxFilterControlStrs
//================================
// cxFilterBoolOperator
cxSetResourceString(@cxSFilterBoolOperatorAnd, 'EN');
cxSetResourceString(@cxSFilterBoolOperatorOr, 'OF');
cxSetResourceString(@cxSFilterBoolOperatorNotAnd, 'NIET EN'); // not all
cxSetResourceString(@cxSFilterBoolOperatorNotOr, 'NIET OF'); // not any
cxSetResourceString(@cxSFilterFooterAddCondition, 'Selectie Toevoegen');
//================================
// cxEditConsts
//================================
// Invalid input value. Use escape key to abandon changes.
cxSetResourceString(@cxSEditValidateErrorText, 'Ongeldige invoer waarde. Gebruik escape toets om wijzigingen te annuleren.');
// Date
cxSetResourceString(@cxSDatePopupClear, 'Ledigen'); // Clear
cxSetResourceString(@cxSDatePopupNow, 'Nu'); // Now
cxSetResourceString(@cxSDatePopupOK, 'Ok'); // OK
cxSetResourceString(@cxSDatePopupToday, 'Vandaag'); // Today
cxSetResourceString(@cxSDateError, 'Ongeldige Datum'); // Invalid Date
...
end;
end.发布于 2012-03-28 09:06:35
VCL本地化适用于荷兰、德国和意大利的这里。我不知道丹麦语有什么可用的。
关于自定义资源字符串的本地化,您还不太清楚自己的确切问题,但是支持中心中有几个相关的问题:
cxLocalizerEditor -使创建的自定义资源单元可以使用{$TYPEDADDRESS ON}编译器指令编译
TcxLocalizer -添加创建多个自定义产品的功能
如果没有这些帮助,我建议您在DevExpress支持论坛上打开一个新的问题。
发布于 2017-04-18 17:15:50
1-为每个控件创建定位器类
using DevExpress.XtraGrid.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
class cls_GridLocalizer : GridLocalizer
{
public override string Language { get { return "Arabic"; } }
public override string GetLocalizedString(GridStringId id)
{
string ret = "";
switch (id)
{
case GridStringId.MenuColumnSortAscending: return "فرز تصاعدي";
case GridStringId.MenuColumnSortDescending: return "فرز تنازلي";
case GridStringId.MenuColumnClearSorting: return "الغاء
الفرز";
case GridStringId.MenuColumnGroup: return "تجميع حسب هذا العمود";
.
.
.
.
default:
ret = base.GetLocalizedString(id);
break;
}
return ret;
}
}
}2-从包含网格的表单中调用类:
GridLocalizer.Active = new cls_GridLocalizer();3-享受
https://stackoverflow.com/questions/9903274
复制相似问题