@serenity-is/corelib / EntityLocalizer
Class: EntityLocalizer
Defined in: src/ui/dialogs/entitylocalizer.tsx:43
Manages the localization grid for an entity dialog, letting users edit translations of localizable fields for each language.
Constructors
Constructor
new EntityLocalizer(
opt):EntityLocalizer
Defined in: src/ui/dialogs/entitylocalizer.tsx:56
Creates a localizer and builds the localization grid.
Parameters
opt
Options for the localizer.
Returns
EntityLocalizer
Properties
grid
protectedgrid:PropertyGrid
Defined in: src/ui/dialogs/entitylocalizer.tsx:45
lastValue
protectedlastValue:any
Defined in: src/ui/dialogs/entitylocalizer.tsx:47
pendingValue
protectedpendingValue:any
Defined in: src/ui/dialogs/entitylocalizer.tsx:46
targetLanguage
protectedtargetLanguage:HTMLSelectElement
Defined in: src/ui/dialogs/entitylocalizer.tsx:48
Methods
buttonClick()
buttonClick():
void
Defined in: src/ui/dialogs/entitylocalizer.tsx:224
Toggles localization mode and loads/saves localization values.
Returns
void
clearValue()
clearValue():
void
Defined in: src/ui/dialogs/entitylocalizer.tsx:165
Clears pending and last localization values.
Returns
void
destroy()
destroy():
void
Defined in: src/ui/dialogs/entitylocalizer.tsx:155
Destroys the localization grid.
Returns
void
editSaveRequest()
editSaveRequest(
req):void
Defined in: src/ui/dialogs/entitylocalizer.tsx:317
Adds pending localizations to a save request.
Parameters
req
SaveRequest<any>
The save request to modify.
Returns
void
getLocalizationGridValue()
protectedgetLocalizationGridValue():any
Defined in: src/ui/dialogs/entitylocalizer.tsx:300
Returns the localization values from the grid, keyed by language and field.
Returns
any
The localization values.
getPendingLocalizations()
protectedgetPendingLocalizations():any
Defined in: src/ui/dialogs/entitylocalizer.tsx:327
Returns pending localizations grouped by language.
Returns
any
The pending localizations.
isEnabled()
isEnabled():
boolean
Defined in: src/ui/dialogs/entitylocalizer.tsx:174
Whether the localization grid is enabled (there are localizable fields).
Returns
boolean
True when enabled.
isLocalizationMode()
protectedisLocalizationMode():boolean
Defined in: src/ui/dialogs/entitylocalizer.tsx:204
Whether the dialog is currently in localization mode.
Returns
boolean
True when in localization mode.
isLocalizationModeAndChanged()
protectedisLocalizationModeAndChanged():boolean
Defined in: src/ui/dialogs/entitylocalizer.tsx:212
Whether the localization values changed since the last save.
Returns
boolean
True when changed.
loadLocalization()
protectedloadLocalization():void
Defined in: src/ui/dialogs/entitylocalizer.tsx:245
Loads localization values into the grid.
Returns
void
mapSourceItem()
protectedmapSourceItem(item):PropertyItem
Defined in: src/ui/dialogs/entitylocalizer.tsx:186
Maps a source property item to the item used in the localization grid, using the
dialog supplied EntityLocalizerOptions.mapSourceItem callback. The callback
may return a modified item (e.g. with different permissions / insertable / updatable
flags, or localizable: false to skip it), or null/undefined to use the item as is.
Parameters
item
Source property item.
Returns
The item to use.
setLocalizationGridCurrentValues()
protectedsetLocalizationGridCurrentValues():void
Defined in: src/ui/dialogs/entitylocalizer.tsx:275
Copies current field values into the localization grid as hints.
Returns
void
setMode()
setMode(
mode):void
Defined in: src/ui/dialogs/entitylocalizer.tsx:196
Applies the insert/update mode to the localization grid, so that insertable / updatable flags and field level permissions are evaluated for the current operation. The dialog calls this whenever the main property grid mode changes.
Parameters
mode
The property grid mode.
Returns
void
updateInterface()
updateInterface():
void
Defined in: src/ui/dialogs/entitylocalizer.tsx:353
Updates the UI to reflect the current localization mode.
Returns
void