How to implement NLS support for custom widget property
To create National Language Support (NLS) for custom widgets, you may simply set;
- UseNLS: true
This will enable to NLS settings for the widget property (example below). User then needs to set valid UI Strings for the NLS translations.
Further information: Please refer the link for setting the NLS strings Configure NLS for Label Widget
import { cWidgetBase, IWidgetBaseConfig } from "widgetbase/widgetbase";
import { registerWidget } from "@cpmplus/widget-support/register-widget";
import { IProperty } from "componentbase/propertyapi";
import { cPropertyType } from "componentbase/propertytype";
class Widget extends cWidgetBase {
private Message: IProperty<string> = this.Properties.Add(
"Message", cPropertyType.Text, {
Category: "General",
Description: "Enter the Message",
IsBrowsable: true,
IsSerializable: true,
UseNLS: true,
DefaultValue: ""
}
);
constructor(parent: HTMLElement, config: IWidgetBaseConfig) {
super(parent);
this.Properties.Read(config);
this.Message.OnChange(() => {
parent.innerHTML = "Hello ! "+this.Message.Get();
});
parent.innerHTML = "Hello ! "+this.Message.Get();
}
}
registerWidget(Widget);
Updated 17 days ago
Did this page help you?

