5.5 KiB
5.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:08:29.234915+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.TestModification namespace. It consists of a strongly-typed resource wrapper class, StringResources, which provides compile-time access to localized strings (likely sourced from a .resx file), and a XAML markup extension, TranslateExtension, that allows WPF UI elements to bind to these localized strings declaratively.
2. Public Interface
Class: TranslateExtension
Namespace: DTS.Viewer.TestModification
Inheritance: System.Windows.Markup.MarkupExtension
This class allows XAML bindings to retrieve localized strings using a resource key.
- Constructor
public TranslateExtension(string key): Initializes the extension with the specific resource key to look up.
- Method
public override object ProvideValue(IServiceProvider serviceProvider): Returns the localized string associated with the_key. If the key is null, empty, or not found in the resource manager, it returns an error string constant.
Class: StringResources
Namespace: DTS.Viewer.TestModification.Resources
Accessibility: internal
A strongly-typed resource class auto-generated by Visual Studio. It exposes localized strings as static properties.
- Properties
internal static global::System.Resources.ResourceManager ResourceManager: Returns the cachedResourceManagerinstance responsible for retrieving resources.internal static global::System.Globalization.CultureInfo Culture: Gets or sets the currentCultureInfoused for resource lookups.
- Resource String Properties (Static)
string CalDate: "Cal date"string DataFlag: "Data Flag:"string Description: "Description:"string EUMultiplier: "EU Multiplier:"string EUOffset: "EU Offset:"string FailedToModifySensitivity: "Failed to modify sensitivity: "string Filter: "Filter:"string LineFit: "Line Fit:"string ModifyDate: "Modify date"string NonLinear: "Non-linear"string PleaseLockHeader: "To enable, please lock a single channel."string Preview: "Preview"string ProportionalToExcitation: "Proportional to excitation"string Sensitivity: "Sensitivity:"string SensorCalibration: "Sensor calibration (most recent in db)"string ShiftT0ms: "Shift T₀ (ms):"string T0MustBeInDataset: "Modification can not be made, T0 must be in the dataset."string T1ms: "T₁ (ms):"string T2ms: "T₂ (ms):"string Undo: "Cancel"string UndoAll: "Restore All"string UndoAllPrompt: "This will revert your saved test modifications to the backup on file. Continue?"string UndoPrompt: "This will undo any change(s) to this channel made before saving. Continue?"string UpdateDatabase: "Update database"string WriteFiles: "Write"string WriteFilesPrompt: "Are you sure you want to write these changes to disk?"
3. Invariants
- Non-Null Return:
TranslateExtension.ProvideValuewill never returnnull. It guarantees a string return, either the localized value or a specific error identifier. - Error Identifier: If a resource key is not found, the return value must contain the constant
#stringnotfound#. If the key is null or empty, it returns exactly#stringnotfound#. If the key is valid but missing from resources, it returns#stringnotfound#followed by a space and the missing key. - Auto-generation:
StringResourcesis marked withGeneratedCodeAttribute. Its members are strictly derived from the underlying resource source (e.g.,.resx). Manual modifications to this file will be lost upon regeneration.
4. Dependencies
- Internal Dependencies:
TranslateExtensiondepends onStringResourcesto perform the actual string lookup viaStringResources.ResourceManager.
- External Dependencies:
System.Windows.Markup: Required forMarkupExtensionandMarkupExtensionReturnTypeAttribute(WPF specific).System.Resources: Required forResourceManager.System.Globalization: Required forCultureInfo.
5. Gotchas
- Auto-Generated File:
StringResources.Designer.csis auto-generated. Developers must edit the corresponding.resxfile (not present in the provided source) to add or modify strings; editing this.csfile directly is futile as changes will be overwritten. - Internal Visibility: The
StringResourcesclass isinternal. It cannot be accessed from outside theDTS.Viewer.TestModificationassembly. - Silent Failures in UI:
TranslateExtensiondoes not throw exceptions for missing keys. Instead, it returns strings like#stringnotfound# MissingKey. This behavior aids in debugging missing translations visually in the UI but requires the developer to inspect the string content rather than catching exceptions. - Static Culture: The
StringResources.Cultureproperty is static. Changing it will affect all subsequent resource lookups within that assembly context, which implies the application is responsible for managing the UI culture lifecycle globally.