46 lines
2.9 KiB
Markdown
46 lines
2.9 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DataPRO/Modules/ISO/ExtraProperties/Resources/TranslateExtension.cs
|
||
|
|
- DataPRO/Modules/ISO/ExtraProperties/Resources/StringResources.Designer.cs
|
||
|
|
generated_at: "2026-04-17T16:12:22.117936+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "98cd5a2347e82926"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Resources
|
||
|
|
|
||
|
|
### Purpose
|
||
|
|
This module provides localization infrastructure for the ISO ExtraProperties feature. It contains a WPF markup extension for XAML-based string resource lookup and an auto-generated strongly-typed resource class that wraps a `.resx` file containing localized strings for validation messages and UI labels related to key-value property handling.
|
||
|
|
|
||
|
|
### Public Interface
|
||
|
|
|
||
|
|
**`TranslateExtension` class** (`MarkupExtension`):
|
||
|
|
- `TranslateExtension(string key)` - Constructor accepting the resource key to look up.
|
||
|
|
- `object ProvideValue(IServiceProvider serviceProvider)` - Returns the localized string for `_key`, or an error marker if not found.
|
||
|
|
|
||
|
|
**`StringResources` class** (internal, auto-generated):
|
||
|
|
- `static ResourceManager ResourceManager { get; }` - Returns the cached `ResourceManager` instance for the `ExtraProperties.Resources.StringResources` resource bundle.
|
||
|
|
- `static CultureInfo Culture { get; set; }` - Gets or sets the current UI culture for resource lookups.
|
||
|
|
- `static string InvalidLine { get; }` - Localized string: "Invalid pasted channel code, line: {0}".
|
||
|
|
- `static string Key { get; }` - Localized string: "Key".
|
||
|
|
- `static string NoValueWarning { get; }` - Localized string: "The following keys have no value:".
|
||
|
|
- `static string RepeatKeyError { get; }` - Localized string: "Keys must be unique. The following repeat:".
|
||
|
|
- `static string Value { get; }` - Localized string: "Value".
|
||
|
|
|
||
|
|
### Invariants
|
||
|
|
- `TranslateExtension._key` is immutable after construction (readonly field).
|
||
|
|
- `ProvideValue` always returns a non-null string; it never returns null.
|
||
|
|
- When `_key` is null or empty, `ProvideValue` returns the constant `"#stringnotfound#"`.
|
||
|
|
- When the resource key is not found in the resource manager, `ProvideValue` returns `"#stringnotfound# "` concatenated with the key name.
|
||
|
|
- `StringResources` is marked `internal` and cannot be accessed outside its assembly.
|
||
|
|
|
||
|
|
### Dependencies
|
||
|
|
- **Depends on**: `System`, `System.Windows.Markup` (for `MarkupExtension` and `MarkupExtensionReturnTypeAttribute`), `System.Resources` (for `ResourceManager`), `System.Globalization` (for `CultureInfo`).
|
||
|
|
- **Depended on by**: Unclear from source alone; presumably XAML files in the ISO ExtraProperties module that use `{x:Static}` or the `TranslateExtension` markup extension.
|
||
|
|
|
||
|
|
### Gotchas
|
||
|
|
- The `NotFound` constant value `"#stringnotfound#"` is hardcoded and duplicated across multiple modules (see DBImportExport/Resources). Changes to this error format would require updates in multiple places.
|
||
|
|
- The `StringResources` class is auto-generated; manual edits will be lost when the `.resx` file is regenerated.
|
||
|
|
|
||
|
|
---
|