Files
DP44/enriched-partialglm/DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/Resources.md
2026-04-17 14:55:32 -04:00

129 lines
5.9 KiB
Markdown

---
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-16T11:16:26.757827+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ef8f2f0524698a0d"
---
# Documentation: DTS.Viewer.TestSummaryList.Resources
## 1. Purpose
This module provides localization/internationalization infrastructure for the TestSummaryList component of the DTS Viewer application. It enables XAML-based string resource lookups through a WPF markup extension (`TranslateExtension`) and exposes strongly-typed access to localized UI strings via the auto-generated `StringResources` class. The module supports the display of test summary information with sortable columns and metadata labels.
---
## 2. Public Interface
### TranslateExtension (DTS.Viewer.TestSummaryList namespace)
A WPF markup extension for resolving localized strings in XAML bindings.
```csharp
[MarkupExtensionReturnType(typeof(string))]
public class TranslateExtension : MarkupExtension
```
**Constructor:**
```csharp
public TranslateExtension(string key)
```
- Creates an instance with the specified resource key to look up.
**Method:**
```csharp
public override object ProvideValue(IServiceProvider serviceProvider)
```
- Returns the localized string for the stored key via `StringResources.ResourceManager.GetString(_key)`.
- Returns `#stringnotfound#` if `_key` is null or empty.
- Returns `#stringnotfound# {key}` if the key is valid but no resource is found.
---
### StringResources (DTS.Viewer.TestSummaryList.Resources namespace)
An internal, auto-generated strongly-typed resource class.
```csharp
internal class StringResources
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `ResourceManager` | `global::System.Resources.ResourceManager` (static) | Cached ResourceManager instance for the `DTS.Viewer.TestSummaryList.Resources.StringResources` resource bundle. |
| `Culture` | `global::System.Globalization.CultureInfo` (static) | Gets or sets the current thread's UI culture for resource lookups. |
**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
1. **Auto-generation constraint**: `StringResources` is auto-generated by `System.Resources.Tools.StronglyTypedResourceBuilder` (version 17.0.0.0). Manual edits will be lost upon regeneration.
2. **Non-null return guarantee**: `TranslateExtension.ProvideValue()` always returns a non-null string. It never returns null—missing keys produce error indicators.
3. **Error format for missing keys**: When a resource key is not found, the return value follows the pattern `#stringnotfound# {key}` where `{key}` is the requested key name.
4. **Empty key handling**: A null or empty `_key` returns exactly `#stringnotfound#` without a trailing key name.
5. **Resource manager identity**: The `ResourceManager` property always returns an instance tied to the resource name `"DTS.Viewer.TestSummaryList.Resources.StringResources"` within the current assembly.
---
## 4. Dependencies
### This module depends on:
- `System` (core types)
- `System.Windows.Markup` (`MarkupExtension`, `MarkupExtensionReturnTypeAttribute`)
- `System.Resources` (`ResourceManager`)
- `System.Globalization` (`CultureInfo`)
- `System.CodeDom.Compiler` (generated code attributes)
- `System.Diagnostics` (generated code attributes)
- `System.Runtime.CompilerServices` (generated code attributes)
- `System.ComponentModel` (`EditorBrowsableAttribute`)
### What depends on this module:
- **Inferred**: XAML files within the `DTS.Viewer.TestSummaryList` module that use `{local:Translate KeyName}` syntax for localized UI strings.
- **Inferred**: Code-behind files that access `StringResources.<PropertyName>` directly for programmatic string retrieval.
---
## 5. Gotchas
1. **Empty Japanese resource file**: `StringResources.ja.Designer.cs` is present but empty. Japanese localization may be incomplete or handled through a different mechanism (e.g., `.resx` file without a separate designer file).
2. **Fallback culture behavior unclear**: The source does not show explicit fallback logic. The actual fallback behavior (e.g., defaulting to English when a culture-specific resource is missing) depends on .NET's standard resource fallback process, which is not visible in this source.
3. **Internal visibility**: `StringResources` is marked `internal`, limiting direct programmatic access to code within the same assembly. External assemblies must use `TranslateExtension` or another exposed mechanism.
4. **Trailing colons in labels**: Several properties (`ChannelCount`, `Description`, `FileDate`, `Sort`, `TestID`, `TestSetup`, `TimeStamp`, `Type`) include trailing colons and spaces in their default values. These are label strings intended for UI pairing with values, not standalone text.
5. **Case-sensitive key lookup**: `TranslateExtension` passes the key directly to `ResourceManager.GetString()`. Key mismatches due to case sensitivity will result in "not found" errors rather than automatic correction.