LLTranslation
Manages translation ListObjects hosted on a single worksheet and provides scoped ITranslationObject accessors, import/export of full translation tables, dictionary-specific exchange, and workbook-level hidden name initialisation for translated configuration values.
Depends on: ITranslationObject, TranslationObject, ICustomTable, CustomTable, IHiddenNames, HiddenNames, BetterArray
Version: 1.0 (2026-02-10)
Factory
create #
Create a new LLTranslation from a translation worksheet
Signature:
Public Function Create(ByVal translationSheet As Worksheet) As ILLTranslation
Instance creation via VB_PredeclaredId factory pattern. Validates that the worksheet is not Nothing and that all required ListObjects are present (T_TradLLMsg, T_TradLLShapes, T_TradLLForms, Tab_Translations). T_TradLLRibbon is optional.
Parameters:
translationSheet: Worksheet. The worksheet hosting all translation ListObjects.
Returns: ILLTranslation. A fully initialised facade.
Throws:
- ProjectError.ObjectNotInitialized When translationSheet is Nothing.
- ProjectError.ElementNotFound When a required ListObject is missing.
Properties
wksh #
Host translation worksheet
Signature:
Public Property Get Wksh() As Worksheet
Accessors for translation objects and the host worksheet. Returns the worksheet bound to this instance.
Returns: Worksheet. The host translation worksheet.
trans-object #
Scoped translation object
Signature:
Public Property Get TransObject(Optional ByVal trans As Byte = TranslationOfMessages) As ITranslationObject
Returns an ITranslationObject configured for the requested translation scope. The language code is resolved from the host workbook HiddenNames (RNG_LLLanguageCode or RNG_DictionaryLanguage depending on scope).
Parameters:
trans: Optional Byte. TranslationScope value selecting the content scope. Defaults to TranslationOfMessages.
Returns: ITranslationObject. The translation object for the requested scope.
Throws:
- ProjectError.ElementNotFound When the requested ListObject does not exist on the host worksheet.
DataExchange
export #
Export all translation tables to an output workbook
Signature:
Public Sub Export(ByVal outputWkb As Workbook, _
Optional ByVal Hide As Long = xlSheetVeryHidden)
Import, export, and dictionary exchange operations. Creates or clears a worksheet in the output workbook matching the host sheet name, then exports every ListObject from the host sheet using CustomTable.Export with stacking. Applies basic formatting and sets the sheet visibility to the Hide parameter value.
Parameters:
outputWkb: Workbook. The destination workbook.Hide: Optional Long. Sheet visibility after export. Defaults to xlSheetVeryHidden.
Throws:
- ProjectError.ObjectNotInitialized When outputWkb is Nothing.
import #
Import translation tables from another workbook
Signature:
Public Sub Import(ByVal fromWkb As Workbook)
Finds a worksheet in the source workbook matching the host sheet name. Cleans the dictionary ListObject before import. For each ListObject on the host sheet, imports data from the matching ListObject on the source sheet. Missing source tables are silently skipped.
Parameters:
fromWkb: Workbook. The source workbook containing translation data.
import-dictionary #
Import dictionary translations from a raw ListObject
Signature:
Public Sub ImportDictionary(ByVal dictionaryTable As ListObject)
Overwrites the host dictionary table with data from the supplied ListObject, preserving the source column headers via keepSourceHeaders.
Parameters:
dictionaryTable: ListObject. The source dictionary ListObject.
Throws:
- ProjectError.ObjectNotInitialized When dictionaryTable is Nothing.
- ProjectError.ElementNotFound When the host dictionary table is not found.
export-dictionary #
Export the dictionary table to a named worksheet
Signature:
Public Sub ExportDictionary(ByVal outputWkb As Workbook, _
Optional ByVal sheetName As String = "Translations", _
Optional ByVal Hide As Long = xlSheetVisible)
Creates or clears a worksheet in the output workbook with the given name, then exports the dictionary ListObject using CustomTable.Export. Applies formatting and sets the sheet visibility.
Parameters:
outputWkb: Workbook. The destination workbook.sheetName: Optional String. Worksheet name for the export. Defaults to "Translations".Hide: Optional Long. Sheet visibility after export. Defaults to xlSheetVisible.
Throws:
- ProjectError.ObjectNotInitialized When outputWkb is Nothing.
- ProjectError.ElementNotFound When the host dictionary table is not found.
SheetNames
initialise-sheet-names #
Create language HiddenNames on the translation worksheet
Signature:
Public Sub InitialiseSheetNames(ByVal dictLang As String, ByVal llLang As String)
Worksheet-level HiddenNames for language codes. Creates worksheet-level HiddenNames for dictionary and interface language codes on the translation worksheet itself. These are later read by InitialiseWorkbookNames in Linelist.cls to propagate language settings to the output workbook.
Parameters:
dictLang: String. The dictionary language code (e.g., "en").llLang: String. The interface language code (e.g., "fr").
ValueAccess
value #
Retrieve a named configuration value from the translation worksheet
Signature:
Public Property Get Value(ByVal nameId As String) As String
Mapped value retrieval from worksheet-level HiddenNames. Returns a worksheet-level HiddenName value identified by a logical key. Supported keys: "dictlang" -> RNG_DictionaryLanguage "lllang" -> RNG_LLLanguageCode Other keys return vbNullString.
Parameters:
nameId: String. The logical key to look up.
Returns: String. The stored value, or vbNullString if the key is unknown.
Internal members (not exported)
Factory
self #
Interface-cast self reference
Signature:
Public Property Get Self() As ILLTranslation
Returns: ILLTranslation. This instance as its interface type.
internal-sheet #
Friend setter for the host worksheet
Signature:
Friend Property Set InternalSheet(ByVal value As Worksheet)
Used by the factory method during construction.
Parameters:
value: Worksheet. The translation worksheet to bind.
Internal Helpers
resolve-list-object #
Resolve a ListObject by name from the host worksheet
Signature:
Private Function ResolveListObject(ByVal tableName As String) As ListObject
Private utility methods. Returns the ListObject with the given name from the host translation worksheet. Raises an error when the table is not found.
Parameters:
tableName: String. The ListObject name to resolve.
Returns: ListObject. The resolved table.
Throws:
- ProjectError.ElementNotFound When the table is not found.
find-or-create-sheet #
Find or create a worksheet in the target workbook
Signature:
Private Function FindOrCreateSheet(ByVal targetWkb As Workbook, _
ByVal targetName As String) As Worksheet
Attempts to find a worksheet with the given name in the target workbook. If found, clears its contents entirely. If not found, creates a new worksheet with the name appended at the end.
Parameters:
targetWkb: Workbook. The target workbook.targetName: String. The worksheet name to find or create.
Returns: Worksheet. The resolved or newly created worksheet.
format-export-sheet #
Apply standard formatting to an exported sheet
Signature:
Private Sub FormatExportSheet(ByVal sh As Worksheet, ByVal Hide As Long)
Sets font, alignment, autofit, and visibility on the exported sheet.
Parameters:
sh: Worksheet. The sheet to format.Hide: Long. Sheet visibility constant.
clean-dictionary #
Clear the dictionary ListObject data
Signature:
Private Sub CleanDictionary()
Wraps the host dictionary table in a CustomTable and calls Clean to clear all non-formula, non-key columns. Silently exits when the dictionary table does not exist.
check-requirements #
Validate that the translation sheet has all required tables
Signature:
Private Sub CheckRequirements(ByVal translationSheet As Worksheet)
Ensures the worksheet is not Nothing and that the required ListObjects (T_TradLLMsg, T_TradLLShapes, T_TradLLForms, Tab_Translations) are present. T_TradLLRibbon is optional and not validated.
Parameters:
translationSheet: Worksheet. The worksheet to validate.
Throws:
- ProjectError.ObjectNotInitialized When the sheet is Nothing.
- ProjectError.ElementNotFound When a required table is missing.
Error Handling
ensure-and-set #
Create a HiddenName if missing, then always update its value
Signature:
Private Sub EnsureAndSet(ByVal store As IHiddenNames, ByVal nameId As String, _
ByVal value As String)
Centralised error raising.
Parameters:
store: IHiddenNames. The hidden names manager.nameId: String. The hidden name identifier.value: String. The value to set.
throw-error #
Raise a ProjectError-based exception
Signature:
Private Sub ThrowError(ByVal errNumber As Long, ByVal message As String)
Parameters:
errNumber: ProjectError. The error constant.message: String. Descriptive error message.
Interface Implementation
ILLTranslation_TransObject #
Signature:
Private Property Get ILLTranslation_TransObject(Optional ByVal trans As Byte = TranslationOfMessages) As ITranslationObject
Delegated members satisfying the ILLTranslation contract.
Used in (32 file(s))
- LLExporter.cls
- DesignerImportService.cls
- IDesignerImportService.cls
- EventLinelist.cls
- IEventLinelist.cls
- ILinelistSpecs.cls
- ILLTranslation.cls
- Linelist.cls
- LinelistSpecs.cls
- LLTranslation.cls
- FormLogicAdvanced.bas
- FormLogicExport.bas
- FormLogicExportMigration.bas
- FormLogicGeo.bas
- FormLogicImportRep.bas
- FormLogicShowVarLabels.bas
- LinelistEvents.bas
- LinelistGeo.bas
- GeoModule.bas
- EventsLinelistButtons.bas
- EventsLinelistRibbon.bas
- FormLogicEpiWeek.bas
- FormLogicGeo.bas
- FormLogicImportRep.bas
- FormLogicShowVarLabels.bas
- EventsGlobalAnalysis.bas
- EventsSpatialAnalysis.bas
- LinelistEvents.bas
- TestLLTranslation.bas
- LinelistSpecsWorkbookStub.cls
- LLVarContextSpecsStub.cls
- TableSpecsLinelistStub.cls