7.4 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T13:58:32.085292+00:00 | zai-org/GLM-5-FP8 | 1 | 5726c0d4d71935f1 |
Documentation: DTS.Viewer.AddCalculatedChannel.Resources
1. Purpose
This module provides localization infrastructure for the "Add Calculated Channel" feature within the DTS Viewer application. It enables XAML-based UI elements to bind to localized strings at design-time and runtime through a WPF markup extension pattern, while the StringResources class serves as a strongly-typed accessor for culture-specific strings related to calculation types, channel operations, IR-TRACC measurements, and validation error messages.
2. Public Interface
TranslateExtension (MarkupExtension)
Class Definition:
[MarkupExtensionReturnType(typeof(string))]
public class TranslateExtension : MarkupExtension
Constructor:
public TranslateExtension(string key)
Initializes the extension with a resource key to look up.
Method:
public override object ProvideValue(IServiceProvider serviceProvider)
Returns the localized string for the provided _key. Returns #stringnotfound# if _key is null or empty. Returns #stringnotfound# <key> (where <key> is the actual key value) if the resource manager returns null for the given key.
StringResources (Auto-generated Resource Class)
Class Definition:
internal class StringResources
Properties:
| Property | Type | Description |
|---|---|---|
ResourceManager |
global::System.Resources.ResourceManager (static) |
Cached ResourceManager instance for the DTS.Viewer.AddCalculatedChannel.Resources.StringResources resource bundle |
Culture |
global::System.Globalization.CultureInfo (static) |
Gets or sets the current thread's CurrentUICulture for resource lookups |
Resource String Properties (static, read-only):
| Property Name | Default Value (from comments) |
|---|---|
AddCalculatedChannel |
"Add Calculated Channel" |
CalculatedChannel_Average |
"Average" |
CalculatedChannel_Sum |
"Sum" |
CalculatedChannel_IRTRACC3D |
"3D IR-TRACC (upper thorax)" |
CalculatedChannel_IRTRACC3D_Abdomen |
"3D IR-TRACC (abdomen)" |
CalculatedChannel_IRTRACC3D_LowerThorax |
"3D IR-TRACC (lower thorax)" |
CalculatedChannel_IRTRACC3D_Thorax |
"3D IR-TRACC (thorax)" |
CalculatedChannel_IRTRACC3DAbdomen |
"3D IR-TRACC (abdomen)" |
CalculatedChannel_IRTRACC3DLowerThorax |
"3D IR-TRACC (lower thorax)" |
Calculation |
"Calculation" |
CALCULATION_Cos |
"Cosine" |
CALCULATION_Derivative |
"Derivative" |
CALCULATION_DoubleIntegral |
"Double integral" |
CALCULATION_Integral |
"Integral" |
CALCULATION_Sin |
"Sine" |
CALCULATION_ThreeDIRTracc |
"3D IR-TRACC (upper thorax)" |
CALCULATION_ThreeDIRTraccAbdomen |
"3D IR-TRACC (abdomen)" |
CALCULATION_ThreeDIRTraccLowerThorax |
"3D IR-TRACC (lower thorax)" |
CalculationInputChannel |
"Calculation Input Channel" |
Channel |
"Channel" |
ChannelName |
"Channel Name" |
ClipLengthMS |
"Clip length (ms)" |
Description |
"Description" |
HICAccelerationX |
"Acceleration X" |
HICAccelerationY |
"Acceleration Y" |
HICAccelerationZ |
"AccelerationZ" |
HICRequires3Channels |
"Error: Head injury criterion requires 3 channels." |
InputChannels |
"Input channels" |
ISOCode |
"ISO Code" |
NoChannelsIncluded |
"Error: No channels included." |
ResultantUnitsDontMatch |
"Error: Units don't match for all input channels." |
SampleRatesDontMatch |
"Error: Sample rates don't match for all input channels." |
SuperSamplingWarning |
"Calculation contains multiple sample rates. Input will be resampled to the highest sample rate using linear interpolation." |
ThreeD_IRTracc |
"IR-TRACC" |
ThreeD_RotPot1 |
"R. Pot Y" |
ThreeD_RotPot2 |
"R. Pot Z" |
3. Invariants
- TranslateExtension return guarantee:
ProvideValuealways returns a non-nullstringobject; it never returns null. - Error indicator format: Missing keys are indicated by the constant
#stringnotfound#(exact literal, lowercase), optionally followed by a space and the key name. - StringResources visibility: The
StringResourcesclass isinternaland only accessible within theDTS.Viewer.AddCalculatedChannelassembly. - Auto-generation constraint:
StringResources.Designer.csis auto-generated bySystem.Resources.Tools.StronglyTypedResourceBuilder(version 17.0.0.0). Manual edits will be lost upon regeneration. - Resource bundle path: Resources are loaded from the manifest resource name
"DTS.Viewer.AddCalculatedChannel.Resources.StringResources".
4. Dependencies
This module depends on:
System(core types)System.Windows.Markup(forMarkupExtensionandMarkupExtensionReturnTypeAttribute)System.Resources(forResourceManager)System.Globalization(forCultureInfo)System.CodeDom.Compiler,System.Diagnostics,System.Runtime.CompilerServices,System.ComponentModel,System.Diagnostics.CodeAnalysis(for auto-generated attributes)
What depends on this module:
- Inferred: XAML files within the
DTS.Viewer.AddCalculatedChannelnamespace that use the{local:Translate KeyName}markup extension syntax for localized UI strings. - Inferred: Code-behind files that reference
StringResources.<PropertyName>for error messages and labels.
5. Gotchas
-
Duplicate/near-duplicate resource keys: Several IR-TRACC-related strings exist with different naming conventions that produce identical default values:
CalculatedChannel_IRTRACC3D_AbdomenandCalculatedChannel_IRTRACC3DAbdomenboth default to "3D IR-TRACC (abdomen)"CalculatedChannel_IRTRACC3D_LowerThoraxandCalculatedChannel_IRTRACC3DLowerThoraxboth default to "3D IR-TRACC (lower thorax)"CALCULATION_ThreeDIRTraccandCalculatedChannel_IRTRACC3Dboth default to "3D IR-TRACC (upper thorax)"
This may indicate a naming convention migration or accidental duplication. The source alone does not clarify which keys are actively used.
-
Inconsistent key naming conventions: Resource keys use at least three different naming patterns:
PascalCase(e.g.,Channel,Description)Category_Property(e.g.,CalculatedChannel_Average)CATEGORY_Property(e.g.,CALCULATION_Sin,CALCULATION_Derivative)
Developers adding new keys should verify which convention is expected.
-
Typo in HICAccelerationZ: The default value is "AccelerationZ" (no space), whereas
HICAccelerationXandHICAccelerationYhave spaces ("Acceleration X", "Acceleration Y"). This inconsistency is visible in the source comments. -
NotFound constant is private: The
NotFoundconstant inTranslateExtensionisprivate const string, so consumers cannot reference it for comparison. The literal#stringnotfound#would need to be hardcoded for string comparison checks. -
No null-coalescing on empty string:
ProvideValuechecksstring.IsNullOrEmpty(_key), returningNotFoundwithout appending the key. However, if_keyis an empty string, the caller receives#stringnotfound#without indication that an empty string was passed.