--- source_files: - DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Resources/StringResources.ja.Designer.cs - DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Resources/TranslateExtension.cs - DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Resources/StringResources.Designer.cs generated_at: "2026-04-16T13:54:20.692720+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "ef8f2f0524698a0d" --- # Documentation: DTS.Viewer.TestSummaryList.Resources ## 1. Purpose This module provides localization infrastructure for the TestSummaryList component of the DTS Viewer application. It consists of a strongly-typed resource accessor class (`StringResources`) generated from a .resx file, and a WPF markup extension (`TranslateExtension`) that enables XAML bindings to localized strings. The module supports UI string lookup for test summary list operations including sorting, filtering, and displaying test metadata. --- ## 2. Public Interface ### `TranslateExtension` (WPF Markup Extension) **Namespace:** `DTS.Viewer.TestSummaryList` **Class Declaration:** ```csharp [MarkupExtensionReturnType(typeof(string))] public class TranslateExtension : MarkupExtension ``` | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `TranslateExtension(string key)` | Initializes the extension with the resource key to look up. Stores the key in a private readonly field `_key`. | | `ProvideValue` | `override object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for `_key` from `StringResources.ResourceManager`. Returns `#stringnotfound#` if `_key` is null or empty. Returns `#stringnotfound# ` if the key is not found in resources. | --- ### `StringResources` (Auto-generated Resource Class) **Namespace:** `DTS.Viewer.TestSummaryList.Resources` **Class Declaration:** ```csharp [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class StringResources ``` | Property | Return Type | Description | |----------|-------------|-------------| | `ResourceManager` | `global::System.Resources.ResourceManager` (static) | Returns the cached ResourceManager instance for this assembly. Lazy-initialized on first access. | | `Culture` | `global::System.Globalization.CultureInfo` (static) | Gets or sets the current culture for resource lookups. Overrides `CurrentUICulture` for this class. | **Localized String Properties (all `internal static string`):** | Property | Default Value (from comments) | |----------|-------------------------------| | `Browse` | "Browse..." | | `ChannelCount` | "Channels: " | | `Description` | "Description: " | | `FileDate` | "File Date: " | | `FileDateAscending` | "File Date" | | `FileDateDescending` | "File Date (Descending)" | | `IdAscending` | "Test ID" | | `IdDescending` | "Test ID (Descending)" | | `Refresh` | "Refresh" | | `SetupNameAscending` | "Test Setup" | | `SetupNameDescending` | "Test Setup (Descending)" | | `Sort` | "Sort: " | | `TestID` | "Test ID: " | | `TestSetup` | "Test Setup: " | | `TimeStamp` | "TimeStamp: " | | `TimeStampAscending` | "TimeStamp" | | `TimeStampDescending` | "TimeStamp (Descending)" | | `Type` | "Type: " | --- ## 3. Invariants - **Non-null return guarantee:** `TranslateExtension.ProvideValue` always returns a non-null string, never returns null. - **Fallback behavior:** Missing or empty keys always produce a string containing `#stringnotfound#`. - **Key preservation:** When a key is not found in resources, the returned string includes the original key name for debugging purposes. - **Thread safety:** `StringResources.ResourceManager` uses a lazy-initialization pattern with a local temporary variable, ensuring only one `ResourceManager` instance exists. - **Auto-generated constraint:** `StringResources` is tool-generated; manual edits will be overwritten on regeneration. - **Visibility:** `StringResources` is `internal`, restricting access to within the `DTS.Viewer.TestSummaryList` assembly. --- ## 4. Dependencies ### This module depends on: - `System` - For `ResourceManager`, `CultureInfo`, and base types - `System.Windows.Markup` - For `MarkupExtension` and `MarkupExtensionReturnTypeAttribute` (WPF infrastructure) - `System.CodeDom.Compiler` - For `GeneratedCodeAttribute` (auto-generated code marker) - A `.resx` file (not provided in source) - The source file for `StringResources` string values ### What depends on this module: - **Inferred:** XAML files within `DTS.Viewer.TestSummaryList` that use `{local:Translate KeyName}` syntax for localized UI strings - **Inferred:** Code-behind files that reference `StringResources.` directly --- ## 5. Gotchas 1. **Missing Japanese resource file:** `StringResources.ja.Designer.cs` is empty in the provided source. It is unclear whether this is intentional (placeholder for future localization) or a configuration issue. 2. **Debugging missing keys:** The `NotFound` constant (`#stringnotfound#`) will be visible in the UI if a key is misspelled or missing. This is intentional for debugging but could leak into production if keys are not validated. 3. **Culture not automatically set:** The `StringResources.Culture` property must be explicitly set; there is no automatic synchronization with `Thread.CurrentUICulture` beyond the default `ResourceManager` behavior. 4. **Trailing colons in labels:** Several resource strings (e.g., `ChannelCount`, `Description`, `FileDate`, `TestID`, `TestSetup`, `TimeStamp`, `Type`) include trailing colons and spaces in their default values. Removing these from the .resx could break UI layout assumptions. 5. **No parameter validation in constructor:** `TranslateExtension` accepts any string including whitespace-only strings; only `null` or empty strings trigger the fallback in `ProvideValue`.