8.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:20:45.009025+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 consists of a WPF XAML markup extension (TranslateExtension) that enables declarative resource lookups in XAML bindings, and a strongly-typed resource accessor class (StringResources) that wraps a .resx file containing localized strings for UI elements, calculation types, error messages, and IR-TRACC measurement labels. The module supports the crash test data analysis domain, providing terminology for head injury criterion (HIC), 3D IR-TRACC calculations, and various mathematical operations.
2. Public Interface
TranslateExtension (DTS.Viewer.AddCalculatedChannel)
A WPF markup extension for performing localized string lookups in XAML.
[MarkupExtensionReturnType(typeof(string))]
public class TranslateExtension : MarkupExtension
Constructor:
TranslateExtension(string key)— Initializes the extension with the resource key to look up. The key is stored in a private readonly field_key.
Methods:
public override object ProvideValue(IServiceProvider serviceProvider)— Returns the localized string for the stored key. Returns#stringnotfound#if_keyis null or empty. Returns#stringnotfound# {key}if the resource manager returns null for the given key.
Constants:
private const string NotFound = "#stringnotfound#"— Fallback string used when a resource lookup fails.
StringResources (DTS.Viewer.AddCalculatedChannel.Resources)
An auto-generated, strongly-typed resource accessor class. This class is internal.
internal class StringResources
Static Properties:
| Property | Type | Description |
|---|---|---|
ResourceManager |
global::System.Resources.ResourceManager |
Lazily-initialized cached ResourceManager instance for the DTS.Viewer.AddCalculatedChannel.Resources.StringResources resource bundle. |
Culture |
global::System.Globalization.CultureInfo |
Gets or sets the current thread's UI culture for resource lookups. |
Resource String Properties (static, read-only):
The following localized string properties are exposed. All return string:
AddCalculatedChannel— "Add Calculated Channel"CalculatedChannel_Average— "Average"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)"CalculatedChannel_Sum— "Sum"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 always returns a non-null string. The
ProvideValuemethod guarantees a string return value—either the localized resource,#stringnotfound#, or#stringnotfound# {key}. -
Empty/null key handling differs from missing key handling. When
_keyis null or empty, the return is exactly#stringnotfound#. When_keyis valid but the resource is missing, the return is#stringnotfound# {key}(includes the key name). -
StringResources.ResourceManager is lazily initialized and thread-safe. The property uses a null-check pattern with a temporary variable before assignment.
-
StringResources is auto-generated. The class bears
GeneratedCodeAttribute,DebuggerNonUserCodeAttribute, andCompilerGeneratedAttribute. Manual modifications will be lost on regeneration. -
StringResources.Culture defaults to null. If not explicitly set, resource lookups will use the current thread's UI culture.
-
All resource string properties are internal. They are only accessible within the
DTS.Viewer.AddCalculatedChannel.Resourcesnamespace or via friend assemblies.
4. Dependencies
This module depends on:
System— Core .NET typesSystem.Windows.Markup—MarkupExtensionbase class andMarkupExtensionReturnTypeAttributeSystem.Resources—ResourceManagerfor resource lookupsSystem.Globalization—CultureInfofor culture-specific lookupsSystem.CodeDom.Compiler—GeneratedCodeAttribute(auto-generated code)System.Diagnostics—DebuggerNonUserCodeAttributeSystem.Runtime.CompilerServices—CompilerGeneratedAttributeSystem.ComponentModel—EditorBrowsableAttribute
What depends on this module:
Inferred from context: The TranslateExtension class is designed for use in XAML files within the DTS.Viewer.AddCalculatedChannel namespace. The resource strings reference calculation types, IR-TRACC measurements, and HIC (Head Injury Criterion) parameters, suggesting this module supports a crash test data analysis UI.
Note: The actual XAML consumers and other code-behind files that reference StringResources are not present in the provided source files.
5. Gotchas
-
Duplicate/overlapping resource keys exist. There appear to be semantically duplicate keys with slightly different naming conventions:
CalculatedChannel_IRTRACC3D_AbdomenandCalculatedChannel_IRTRACC3DAbdomenboth return "3D IR-TRACC (abdomen)"CalculatedChannel_IRTRACC3D_LowerThoraxandCalculatedChannel_IRTRACC3DLowerThoraxboth return "3D IR-TRACC (lower thorax)"CalculatedChannel_IRTRACC3DandCALCULATION_ThreeDIRTraccboth return "3D IR-TRACC (upper thorax)"
This may indicate a naming convention shift or migration artifact. Developers should verify which key is intended for use in new code.
-
Inconsistent naming conventions. Some keys use underscores with prefixes (
CALCULATION_*), others use different patterns (CalculatedChannel_*). The rationale for this is unclear from source alone. -
HICAccelerationZ lacks a space. The value is "AccelerationZ" while X and Y variants are "Acceleration X" and "Acceleration Y". This may be a typo in the
.resxfile. -
TranslateExtension does not use the Culture property. The extension calls
StringResources.ResourceManager.GetString(_key)without passing a culture, meaning it uses the current thread's UI culture. IfStringResources.Culturehas been set to a different value, the extension will not respect it. -
IServiceProvider parameter is unused. The
serviceProviderparameter inProvideValueis accepted but never used, which is typical for simple markup extensions but worth noting if advanced target-aware behavior is ever needed.