6.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T13:46:55.298377+00:00 | zai-org/GLM-5-FP8 | 1 | 46010437bced3eec |
Documentation: DTS.Viewer.TestModification.Resources
1. Purpose
This module provides localization support for the DTS Viewer Test Modification feature. It enables XAML-based string resource lookup through a WPF markup extension (TranslateExtension) backed by a strongly-typed, auto-generated resource class (StringResources). The module centralizes all user-facing strings for the test modification UI, supporting potential internationalization and ensuring consistent string management.
2. Public Interface
TranslateExtension (public class)
Namespace: DTS.Viewer.TestModification
Base Class: System.Windows.Markup.MarkupExtension
Attribute: [MarkupExtensionReturnType(typeof(string))]
A WPF markup extension that enables XAML bindings to localized string resources.
| Member | Signature | Description |
|---|---|---|
| Constructor | TranslateExtension(string key) |
Initializes the extension with the resource key to look up. The key is stored in a readonly field _key. |
| Method | public override object ProvideValue(IServiceProvider serviceProvider) |
Returns the localized string for the provided key via StringResources.ResourceManager.GetString(_key). Returns #stringnotfound# if key is null/empty, or #stringnotfound# {key} if the key is not found in resources. |
Constants:
private const string NotFound = "#stringnotfound#"— Fallback value returned when a resource key is invalid or missing.
StringResources (internal class)
Namespace: DTS.Viewer.TestModification.Resources
Attributes: [GeneratedCode], [DebuggerNonUserCode], [CompilerGenerated]
An auto-generated strongly-typed resource class. Do not modify manually — edits will be lost on regeneration.
| Member | Signature | Description |
|---|---|---|
| Property | internal static ResourceManager ResourceManager |
Returns the cached ResourceManager instance for the resource bundle "DTS.Viewer.TestModification.Resources.StringResources". Lazily initialized. |
| Property | internal static CultureInfo Culture |
Gets or sets the CultureInfo used for resource lookups. Overrides CurrentUICulture for this resource class. |
Localized String Properties (all internal static string):
| Property | Default Value (from comments) |
|---|---|
CalDate |
"Cal date" |
DataFlag |
"Data Flag:" |
Description |
"Description:" |
EUMultiplier |
"EU Multiplier:" |
EUOffset |
"EU Offset:" |
FailedToModifySensitivity |
"Failed to modify sensitivity: " |
Filter |
"Filter:" |
LineFit |
"Line Fit:" |
ModifyDate |
"Modify date" |
NonLinear |
"Non-linear" |
PleaseLockHeader |
"To enable, please lock a single channel." |
Preview |
"Preview" |
ProportionalToExcitation |
"Proportional to excitation" |
Sensitivity |
"Sensitivity:" |
SensorCalibration |
"Sensor calibration (most recent in db)" |
ShiftT0ms |
"Shift T₀ (ms):" |
T0MustBeInDataset |
"Modification can not be made, T0 must be in the dataset." |
T1ms |
"T₁ (ms):" |
T2ms |
"T₂ (ms):" |
Undo |
"Cancel" |
UndoAll |
"Restore All" |
UndoAllPrompt |
"This will revert your saved test modifications to the backup on file. Continue?" |
UndoPrompt |
"This will undo any change(s) to this channel made before saving. Continue?" |
UpdateDatabase |
"Update database" |
WriteFiles |
"Write" |
WriteFilesPrompt |
"Are you sure you want to write these changes to disk?" |
3. Invariants
- Key immutability: The
_keyfield inTranslateExtensionis readonly and set only at construction time. - Fallback behavior:
ProvideValuewill never return null — it always returns either a valid localized string or a string containing#stringnotfound#. - Error differentiation: A null/empty key returns
"#stringnotfound#"alone; a missing key returns"#stringnotfound# {key}"(includes the key name). - Resource manager singleton:
StringResources.ResourceManageris lazily initialized and cached; subsequent accesses return the same instance. - Auto-generated code:
StringResources.Designer.csis regenerated by tooling; manual changes will be overwritten.
4. Dependencies
This module depends on:
System— Core .NET typesSystem.Windows.Markup—MarkupExtensionbase class for XAML supportSystem.Resources—ResourceManagerfor resource lookupSystem.Globalization—CultureInfofor localizationSystem.CodeDom.Compiler,System.Diagnostics,System.Runtime.CompilerServices— Attributes for auto-generated code
What depends on this module:
- XAML files in
DTS.Viewer.TestModificationthat use the{x:Static}or{local:Translate}markup extension pattern for localized UI strings - Code-behind in the TestModification module that accesses
StringResourcesproperties directly
5. Gotchas
-
Different error formats: A null/empty key returns
"#stringnotfound#"without the key name, while a valid-but-missing key returns"#stringnotfound# {key}". This could cause confusion when debugging missing resources. -
Auto-generated file:
StringResources.Designer.csis tool-generated. To add or modify strings, edit the.resxfile, not this file. The comments explicitly warn: "Changes to this file may cause incorrect behavior and will be lost if the code is regenerated." -
Internal visibility:
StringResourcesisinternal, limiting access to within the assembly.TranslateExtensionispublic, making it usable from XAML regardless of assembly boundaries. -
Culture management: The
Cultureproperty onStringResourcesallows overriding the lookup culture, but this is a global setting for the class. If set, it affects all subsequent resource lookups through this class. It is unclear from source alone whether/how the application manages this property at runtime.