--- source_files: - DataPRO/Modules/TestSetups/CachedItemsList/Resources/TranslateExtension.cs - DataPRO/Modules/TestSetups/CachedItemsList/Resources/StringResources.Designer.cs generated_at: "2026-04-17T16:12:50.916382+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "b004bb021a814472" --- # Resources ### 1. Purpose This module provides localization resources specifically for the `CachedItemsList` functionality within the TestSetups system. It enables XAML-based UI components to bind to localized strings via a markup extension and exposes strongly-typed string properties for keys such as "CacheTime", "Hardware", and "Sensor" for use in code-behind or other logic. ### 2. Public Interface * **`TranslateExtension` (Class)** * *Signature*: `public class TranslateExtension : MarkupExtension` * *Constructor*: `TranslateExtension(string key)` — Initializes the extension with the resource key to look up. * *Method*: `public override object ProvideValue(IServiceProvider serviceProvider)` — Returns the localized string corresponding to `_key`. Returns `#stringnotfound#` if the key is null/empty, or `#stringnotfound# ` if the lookup fails. * **`StringResources` (Class)** * *Signature*: `internal class StringResources` * *Properties*: Provides access to specific localized strings. * `string CacheTime`: Looks up "Cache Time". * `string DBTime`: Looks up "Db Time". * `string Deleted`: Looks up "[Deleted]". * `string Hardware`: Looks up "Hardware". * `string Name`: Looks up "Name". * `string ObjectType`: Looks up "(Type)". * `string Prepare_TestSetups_EditTestSetup_Page_Update`: Looks up "Refresh". * `string Sensor`: Looks up "Sensor". * `string SensorCal`: Looks up "Sensor calibration". * *Property*: `static ResourceManager ResourceManager` — Returns the cached resource manager for this assembly. * *Property*: `static CultureInfo Culture` — Gets or sets the current UI culture for resource lookups. ### 3. Invariants * `TranslateExtension` always returns a non-null string. It never returns `null` or throws exceptions for missing keys; it returns a fallback error string instead. * `StringResources.ResourceManager` is lazily initialized and cached; it is thread-safe upon initialization via the standard .NET pattern shown. * The `StringResources` class is `internal` and cannot be accessed outside the `CachedItemsList` assembly. ### 4. Dependencies * **Depends on**: `System`, `System.Windows.Markup`, `System.Globalization`, `System.Resources`. * **Resource File**: Implicitly depends on a `.resx` file (likely `StringResources.resx`) that generates the `StringResources` class. ### 5. Gotchas * The `TranslateExtension` swallows missing key errors silently in the UI by returning `#stringnotfound#`. This is useful for debugging but requires UI inspection to catch missing translations. * The constant `NotFound` is defined locally within `TranslateExtension`. If other modules use a similar pattern, the error string format is duplicated rather than shared. ---