Files
DP44/docs/ai/DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Resources.md
2026-04-17 14:55:32 -04:00

2.1 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Resources/TranslateExtension.cs
DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Resources/StringResources.Designer.cs
2026-04-17T16:11:50.603414+00:00 zai-org/GLM-5-FP8 1 b9710c66f9ec0c0d

Resources

Purpose

This module provides localization/internationalization support for the DTS.Viewer.Filter module. It enables XAML-based string resource lookup through a markup extension pattern, allowing UI elements to display localized strings at design-time and runtime without code-behind resource lookups.

Public Interface

TranslateExtension class (inherits MarkupExtension)

  • TranslateExtension(string key) - Constructor accepting the resource key to look up.
  • object ProvideValue(IServiceProvider serviceProvider) - Returns the localized string for _key, or a fallback error string if not found.
  • Constant: NotFound = "#stringnotfound#" - Fallback prefix used when resource lookup fails.

StringResources class (internal, auto-generated)

  • static ResourceManager ResourceManager { get; } - Lazily-initialized, cached ResourceManager for the DTS.Viewer.Filter.Resources.StringResources resource bundle.
  • static CultureInfo Culture { get; set; } - Overrides the current thread's CurrentUICulture for resource lookups.
  • static string Search { get; } - Localized string resource for "Search".

Invariants

  • ProvideValue always returns a non-null string.
  • If _key is null or empty, ProvideValue returns exactly NotFound ("#stringnotfound#").
  • If the resource key does not exist in the resource bundle, ProvideValue returns NotFound + " " + _key (e.g., "#stringnotfound# MissingKey").
  • ResourceManager is lazily instantiated on first access and cached thereafter.

Dependencies

  • Depends on: System, System.Windows.Markup, System.Resources, System.Globalization.
  • Depended on by: XAML views within the DTS.Viewer.Filter module that use {local:Translate KeyName} syntax.

Gotchas

  • StringResources