API reference
@searsuite/sear-plugin-i18n
Editor-local locale registration and built-in English and Chinese formula locales.
16 exportsderived from source
- classSheetI18nLocaleRegistrysource ↗
-
class SheetI18nLocaleRegistryEditor-local registry for built-in and third-party locale contributions.
constructorconstructor SheetI18nLocaleRegistry(): SheetI18nLocaleRegistrypropertysymbolstatic readonly symbol: typeof symbolDI token for resolving SheetI18nLocaleRegistry.
methodenforceCommandBoundary enforceCommandBoundary(isExecuting: (): boolean, dispatchRemoval: (id: number): void): voidSeals runtime registrations after every plugin has started.
isExecuting: (): booleandispatchRemoval: (id: number): void
methodget get(locale: string): SheetI18nLocaleEntry | undefinedReturns a registered locale contribution, if present.
locale: string
methodhas has(locale: string): booleanReturns whether a locale id is registered.
locale: string
methodlist list(): readonly SheetI18nLocaleEntry[]Lists registered locale contributions in stable locale-id order.
methodregister register(registration: SheetI18nLocaleRegistration): (): voidRegisters one locale contribution and returns an idempotent disposer.
registration: SheetI18nLocaleRegistration
methodrequire require(locale: string): SheetI18nLocaleEntryReturns a required locale contribution.
locale: string
methodunregister unregister(id: number): voidRemoves one contribution through the locale owner's command after assembly.
id: number
- classSheetI18nPluginsource ↗
-
class SheetI18nPlugin extends Plugin<SearCoreSheet, CellProperties, null>, IFormulaLocaleProvider, ICellFormatLocaleProviderEditor-local i18n plugin for built-in English and Chinese locale services.
constructorconstructor SheetI18nPlugin(locales: SheetI18nLocaleRegistry): SheetI18nPluginCreates a SheetI18nPlugin instance.
locales: SheetI18nLocaleRegistry
propertypluginKeystatic readonly pluginKey: PluginKeyStable plugin key for SheetI18nPlugin.
propertysymbolstatic readonly symbol: typeof symbolDI token for resolving SheetI18nPlugin.
methodapply apply(state: null, _transaction: Transaction): nullApplies no document mutations because i18n is local runtime state.
state: null_transaction: Transaction
methodgetCellFormatLocale getCellFormatLocale(): CellFormatLocaleICellFormatLocaleProvider implementation.
methodgetDateTimeLocale getDateTimeLocale(): FormulaDateTimeLocaleIFormulaLocaleProvider implementation.
methodgetLocale getLocale(): stringReturns the active locale.
methodgetPluginConfig getPluginConfig(): nullReturns the plugin config.
methodgetTextLocale getTextLocale(): FormulaTextLocaleIFormulaLocaleProvider implementation.
methodinitialize initialize(context: { container: Container }): voidDiscovers formula scheduling after the formula runtime has registered its services.
context: { container: Container }
methodregisterCapabilities registerCapabilities(registry: RuntimeCapabilityRegistry): voidPublishes the i18n locale registry for third-party locale contributions.
registry: RuntimeCapabilityRegistry
methodregisterCommands registerCommands(commands: SheetCommandBus): voidRegisters language switching commands.
commands: SheetCommandBus
methodregisterObservations registerObservations(observations: ObservationRegistry): voidRegisters the current i18n state observation.
observations: ObservationRegistry
methodregisterSessionState registerSessionState(registry: SessionStateRegistry): voidRegisters local i18n state for in-memory editor remounts.
registry: SessionStateRegistry
methodregisterState registerState(): { dataEngine: { enabled: boolean }; key: PluginKey; state: null }Registers private plugin state.
methodrender render(): Node<CellProperties>[]This plugin renders no scene nodes.
methodsealRuntimeWrites sealRuntimeWrites(): voidCloses runtime-owned extension writes after every plugin has initialized and started.
methodsetLocale setLocale(locale: string): voidUpdates the active locale and notifies observers.
locale: string
methodtoggleLocale toggleLocale(): voidToggles between English and Chinese.
methodregisterServicesstatic registerServices(context: { container: Container }): voidPublishes this plugin as the editor-local formula locale provider.
context: { container: Container }
Inherited members 29
Inherited from Plugin.
- depth
- documentState
- interestedIn
- pluginKey
- transactionHistory
- transactionOT
- warnOnDuplicateDepth
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- lockCommittedState
- onClick
- onDblClick
- onInitialDataCell
- onInitialDataComplete
- onMouseDown
- onMouseMove
- onMouseUp
- onResize
- onScroll
- onTransactionCommitted
- projectTransaction
- registerConfig
- sealRuntimeMetadata
- sealRuntimeMethods
- setState
- interfaceSetSheetLocaleInputsource ↗
-
interface SetSheetLocaleInputInput for setting the editor-local language.
propertylocale readonly locale: string - interfaceSheetI18nLocaleEntrysource ↗
-
interface SheetI18nLocaleEntryNormalized locale contribution stored by the editor-local registry.
propertycellFormatLocale readonly cellFormatLocale: CellFormatLocaleSheet cell number and date/time display defaults for this locale.
propertydateTimeLocale readonly dateTimeLocale: FormulaDateTimeLocaleFormula date/time parser and formatter for this locale.
propertydateTimeSymbols readonly dateTimeSymbols?: FormulaDateTimeSymbolsLocale-specific date/time symbols used by the shared Excel parser.
propertydisplayName readonly displayName: stringUser-facing language label supplied by the owner.
propertylocale readonly locale: stringStable locale id, normally a BCP-47 tag such as en, zh-CN, ja-JP, or fr-FR.
propertytextLocale readonly textLocale: FormulaTextLocaleFormula text byte/width strategy for DBCS-compatible functions.
- interfaceSheetI18nLocaleRegistrationsource ↗
-
interface SheetI18nLocaleRegistrationLocale contribution registered with the editor-local i18n registry.
propertycellFormatLocale readonly cellFormatLocale?: CellFormatLocaleSheet cell number and date/time display defaults for this locale.
propertydateTimeLocale readonly dateTimeLocale?: FormulaDateTimeLocaleFormula date/time parser and formatter for this locale.
propertydateTimeSymbols readonly dateTimeSymbols?: FormulaDateTimeSymbolsLocale-specific date/time symbols used by the shared Excel parser.
propertydisplayName readonly displayName: stringUser-facing language label supplied by the owner.
propertylocale readonly locale: stringStable locale id, normally a BCP-47 tag such as en, zh-CN, ja-JP, or fr-FR.
propertytextLocale readonly textLocale?: FormulaTextLocaleFormula text byte/width strategy for DBCS-compatible functions.
- interfaceSheetI18nStatesource ↗
-
interface SheetI18nStateSnapshot published by the sheet i18n observation.
propertylocale readonly locale: string - typeSheetI18nLocalesource ↗
-
type SheetI18nLocale = stringLocale ids are open so third-party plugins can register their own BCP-47 tags.
- variableSetSheetLocaleCommandsource ↗
-
SetSheetLocaleCommand: SheetCommandDefinition<SetSheetLocaleInput, SheetCommandResult>Command that updates the editor-local language.
- variableSheetI18nBuiltInLocalesource ↗
-
SheetI18nBuiltInLocale: { Chinese: "zh"; English: "en" }Built-in locale identifiers registered by sear-plugin-i18n.
- variableSheetI18nLocaleRegistryCapabilitysource ↗
-
SheetI18nLocaleRegistryCapability: RuntimeCapability<SheetI18nLocaleRegistry>Runtime capability that exposes the sheet i18n locale registry to plugins and hosts.
- variableSheetI18nSessionStateDefinitionsource ↗
-
SheetI18nSessionStateDefinition: SessionStateDefinition<SheetI18nState>Local sheet i18n locale retained during in-memory editor remounts.
- variableSheetI18nStateObservationsource ↗
-
SheetI18nStateObservation: StateObservationDefinition<SheetI18nState>Editor-local sheet i18n locale state.
- variableToggleSheetLocaleCommandsource ↗
-
ToggleSheetLocaleCommand: SheetCommandDefinition<void, SheetCommandResult>Command that toggles between the built-in English and Chinese locales.
- variableUnregisterSheetI18nLocaleCommandsource ↗
-
UnregisterSheetI18nLocaleCommand: SheetCommandDefinition<number, SheetCommandResult>Removes one editor-local locale contribution.
- functionisSheetI18nLocalesource ↗
-
isSheetI18nLocale(value: unknown): valueReturns whether a value is a non-empty locale id.
value: unknown
- functionregisterBuiltInSheetI18nLocalessource ↗
-
registerBuiltInSheetI18nLocales(registry: SheetI18nLocaleRegistry): voidRegisters the default English and Chinese locale contributions.
registry: SheetI18nLocaleRegistry
No public exports match that search.