5.9 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-17T15:55:43.662597+00:00 | zai-org/GLM-5-FP8 | 1 | d7d95270db602454 |
Documentation: TTS Import Resources Module
1. Purpose
This module provides localization and internationalization support for the TTS (Test Setup) Import functionality within the DataPRO system. It enables XAML-based UI string resolution through a WPF markup extension pattern, and maintains a strongly-typed catalog of localized strings for test setup operations including sensor assignments, channel configurations, DAS (Data Acquisition System) management, and import validation messaging. The module serves as the presentation layer's interface to localized text resources.
2. Public Interface
TranslateExtension (Class)
Namespace: TTSImport
Attribute: [MarkupExtensionReturnTypeAttribute(typeof(string))]
A WPF markup extension for resolving localized strings in XAML bindings.
| Member | Signature | Description |
|---|---|---|
| Constructor | TranslateExtension(string key) |
Initializes the extension with the resource key to look up. Stores key in readonly field _key. |
NotFound |
public const string NotFound = "#stringnotfound#" |
Constant returned when a resource key cannot be resolved. |
ProvideValue |
public override object ProvideValue(IServiceProvider serviceProvider) |
Returns the localized string for _key via Resources.StringResources.ResourceManager.GetString(_key). Returns NotFound if _key is null or empty. Returns NotFound + " " + _key if the lookup returns null. |
StringResources (Class)
Namespace: TTSImport.Resources
Accessibility: internal
Attributes: [GeneratedCode], [DebuggerNonUserCode], [CompilerGenerated]
An auto-generated strongly-typed resource class providing access to localized strings.
| Member | Signature | Description |
|---|---|---|
ResourceManager |
internal static global::System.Resources.ResourceManager ResourceManager { get; } |
Lazy-initialized cached ResourceManager instance for the resource bundle "TTSImport.Resources.StringResources". |
Culture |
internal static global::System.Globalization.CultureInfo Culture { get; set; } |
Gets or sets the current UI culture for resource lookups. Defaults to null (uses current thread culture). |
Selected Resource String Properties (non-exhaustive):
| Property | Sample Value (from comments) |
|---|---|
AAF_SLICE |
"Requested SLICE AAF: {0}" |
AAF_TDAS |
"Requested TDAS AAF: {0}" |
Added |
"Added" |
Analog |
"Analog" |
AssignSensorPrompt |
"Assign sensor? ID on the channel will be applied to the sensor and removed from any other sensors." |
ImportTestSetup_MustBeCSVOrXML |
"TTS import requires either .csv or .xml input file" |
ImportTestSetup_DuplicateChannelCode |
"{0} is a duplicate Channel Code." |
ImportTestSetup_DuplicateJCode |
"JCode {0} is a duplicate" |
EmptyChannelCodeWarning |
"Non empty channel codes are required, please complete channel codes to continue" |
ExcitationNotSupportedByChannel |
"Sensor excitation {0} not supported by channel" |
SensorNotFound |
"Sensor \"{0}\" not found in database" |
3. Invariants
- Key Immutability: The
_keyfield inTranslateExtensionisreadonlyand set only at construction time. - Fallback Behavior:
ProvideValuewill never return null; it always returns either the resolved string, theNotFoundconstant, orNotFound + " " + _key. - Empty Key Handling: Passing
nullor empty string toTranslateExtensionreturns exactlyNotFound(without the key suffix). - Resource Manager Singleton:
StringResources.ResourceManageruses lazy initialization with a null-check pattern; once initialized, the same instance is returned on subsequent calls. - Auto-Generated Code:
StringResources.Designer.csis tool-generated; manual edits will be lost on regeneration.
4. Dependencies
This Module Depends On:
System(core BCL)System.Windows.Markup(forMarkupExtensionandMarkupExtensionReturnTypeAttribute)System.Resources(forResourceManager)System.Globalization(forCultureInfo)System.CodeDom.Compiler(forGeneratedCodeAttribute)- Embedded
.resxresource files backingStringResources
What Depends On This Module:
- Inferred: XAML views within the
TTSImportmodule that use{tts:Translate KeyName}markup extension syntax for localized UI strings. - Inferred: Code within
TTSImportnamespace that accessesStringResourcesproperties directly for error messages, labels, and validation text.
5. Gotchas
-
Empty Japanese Resource File: The file
StringResources.ja.Designer.csis present but completely empty (0 bytes). It is unclear whether this is intentional (no Japanese localization needed) or a missing/failed code generation. Developers should verify if Japanese localization is required. -
Namespace Discrepancy:
TranslateExtensionresides in namespaceTTSImportbut referencesResources.StringResourceswhich is inTTSImport.Resources. The fully qualified resource path"TTSImport.Resources.StringResources"is hardcoded in the generated class. -
Debugging Difficulty: The
NotFoundfallback pattern (#stringnotfound# keyname) could appear in production UI if resource keys are misspelled or resources are missing, potentially exposing internal key names to end users. -
No Null Propagation on ResourceManager: The
ProvideValuemethod callsResourceManager.GetString(_key)without null-checking theResourceManagerproperty itself (though the property getter handles this internally).