4.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:18:12.490923+00:00 | zai-org/GLM-5-FP8 | 1 | 8d340ea94a701586 |
Documentation: DTS.Viewer.ChartOptions Resources
1. Purpose
This module provides localization infrastructure for the DTS.Viewer.ChartOptions namespace. It consists of a XAML markup extension (TranslateExtension) enabling declarative binding to localized strings in UI layouts, and a strongly-typed resource accessor class (StringResources) that wraps the underlying .resx storage. It exists to decouple UI labels and chart-related text (e.g., "Save Chart", "Min/Max" labels) from the code logic, supporting potential multi-language deployments.
2. Public Interface
Class: TranslateExtension
Namespace: DTS.Viewer.ChartOptions
Inheritance: System.Windows.Markup.MarkupExtension
This class allows XAML bindings to retrieve localized strings directly.
- Constructor:
TranslateExtension(string key)- Initializes the extension with the resource key to be looked up.
- Method:
public override object ProvideValue(IServiceProvider serviceProvider)- Returns the localized string associated with
_key. - Returns
#stringnotfound#if the key is null or empty. - Returns
#stringnotfound# [key]if the lookup fails (key not found in resources).
- Returns the localized string associated with
Class: StringResources
Namespace: DTS.Viewer.ChartOptions.Resources
Accessibility: internal
A strongly-typed resource class generated by Visual Studio/ResGen. It provides static properties to access string values defined in the resource file.
- Property:
static global::System.Resources.ResourceManager ResourceManager- Returns the cached
ResourceManagerinstance for this assembly.
- Returns the cached
- Property:
static global::System.Globalization.CultureInfo Culture- Gets or sets the current UI culture for resource lookups.
- Resource Properties (Static Strings):
ChartUnitType: Looks up "Chart Unit Type".FilterOptions_Title: Looks up "Display Filter".LockT: Looks up "Lock T".MaxT: Looks up "Max:".MaxY: Looks up "Max:".MinT: Looks up "Min:".MinY: Looks up "Min:".Range: Looks up "Range".ResetAll: Looks up "Reset All".ResetT: Looks up "Reset T".SaveChart: Looks up "Save Chart".SaveToPDF: Looks up "Save to PDF".TimeUnitType: Looks up "Time Unit Type".
3. Invariants
- Auto-generation:
StringResourcesis auto-generated; manual modifications toStringResources.Designer.cswill be overwritten if the tool regenerates the file. Changes must be made to the corresponding.resxfile. - Error Handling:
TranslateExtension.ProvideValuewill never returnnull. It guarantees a string return, either the valid translation or a specific error constant. - Key Requirement:
TranslateExtensionrequires a non-null, non-empty string key to attempt a valid lookup.
4. Dependencies
- Internal Dependencies:
TranslateExtensiondepends onDTS.Viewer.ChartOptions.Resources.StringResourcesfor the actual resource lookup logic.
- External Dependencies:
System.Windows.Markup: Required forMarkupExtensionandMarkupExtensionReturnTypeAttribute(WPF specific).System.Resources: Used forResourceManager.System.Globalization: Used forCultureInfo.
5. Gotchas
- Missing Key Formatting: If a resource key is passed to
TranslateExtensionbut does not exist in the.resxfile, the returned string includes the missing key name appended to the error token (e.g.,#stringnotfound# MyMissingKey). This differs from the empty/null key behavior, which returns only the token#stringnotfound#. - Duplicate Values: The source indicates that
MaxTandMaxYboth map to the default value "Max:", andMinT/MinYmap to "Min:". While likely intentional for localization reuse, context-specific nuances might be lost if the localization requirements for Time (T) vs Y-axis diverge in other languages. - Internal Visibility: The
StringResourcesclass is markedinternal. It is not accessible outside theDTS.Viewer.ChartOptionsassembly. External assemblies must rely onTranslateExtension(if public) or cannot access these resources directly.