How to implement NLS support for custom widget property
UseNLS: true - this will enable to NLS settings for the widget property. Used need to set the valid UI Strings for the NLS translations. 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 3 months ago
