Files
2026-04-17 14:55:32 -04:00

5.9 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/Modules/TestSetups/Imports/TTS/Resources/StringResources.ja.Designer.cs
DataPRO/Modules/TestSetups/Imports/TTS/Resources/TranslateExtension.cs
DataPRO/Modules/TestSetups/Imports/TTS/Resources/StringResources.Designer.cs
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 _key field in TranslateExtension is readonly and set only at construction time.
  • Fallback Behavior: ProvideValue will never return null; it always returns either the resolved string, the NotFound constant, or NotFound + " " + _key.
  • Empty Key Handling: Passing null or empty string to TranslateExtension returns exactly NotFound (without the key suffix).
  • Resource Manager Singleton: StringResources.ResourceManager uses lazy initialization with a null-check pattern; once initialized, the same instance is returned on subsequent calls.
  • Auto-Generated Code: StringResources.Designer.cs is tool-generated; manual edits will be lost on regeneration.

4. Dependencies

This Module Depends On:

  • System (core BCL)
  • System.Windows.Markup (for MarkupExtension and MarkupExtensionReturnTypeAttribute)
  • System.Resources (for ResourceManager)
  • System.Globalization (for CultureInfo)
  • System.CodeDom.Compiler (for GeneratedCodeAttribute)
  • Embedded .resx resource files backing StringResources

What Depends On This Module:

  • Inferred: XAML views within the TTSImport module that use {tts:Translate KeyName} markup extension syntax for localized UI strings.
  • Inferred: Code within TTSImport namespace that accesses StringResources properties directly for error messages, labels, and validation text.

5. Gotchas

  1. Empty Japanese Resource File: The file StringResources.ja.Designer.cs is 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.

  2. Namespace Discrepancy: TranslateExtension resides in namespace TTSImport but references Resources.StringResources which is in TTSImport.Resources. The fully qualified resource path "TTSImport.Resources.StringResources" is hardcoded in the generated class.

  3. Debugging Difficulty: The NotFound fallback 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.

  4. No Null Propagation on ResourceManager: The ProvideValue method calls ResourceManager.GetString(_key) without null-checking the ResourceManager property itself (though the property getter handles this internally).