50 lines
3.1 KiB
Markdown
50 lines
3.1 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DataPRO/Modules/SystemSettings/DBImportExport/Resources/TranslateExtension.cs
|
||
|
|
- DataPRO/Modules/SystemSettings/DBImportExport/Resources/StringResources.Designer.cs
|
||
|
|
generated_at: "2026-04-17T16:12:22.120307+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "87d5f6e196d99a39"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Resources
|
||
|
|
|
||
|
|
### Purpose
|
||
|
|
This module provides localization infrastructure for the DB Import/Export feature. It contains a WPF markup extension for XAML-based string resource lookup and an auto-generated strongly-typed resource class containing localized strings for file dialog filters, button labels, and validation messages used in database import/export workflows.
|
||
|
|
|
||
|
|
### 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 `DBImportExport.Resources.StringResources` resource bundle.
|
||
|
|
- `static CultureInfo Culture { get; set; }` - Gets or sets the current UI culture for resource lookups.
|
||
|
|
- `static string ExportFileBrowse_Filter { get; }` - File dialog filter: `"DataPRO DB XML File (*.dbxml)|*.dbxml|All Files (*.*)|*.*"`.
|
||
|
|
- `static string ExportFileData_Empty { get; }` - Message: `"No data to export"`.
|
||
|
|
- `static string ExportFileName_Empty { get; }` - Message: `"No export file name specified"`.
|
||
|
|
- `static string ExportView_Browse { get; }` - Label: `"Browse"`.
|
||
|
|
- `static string ExportView_File { get; }` - Label: `"File"`.
|
||
|
|
- `static string ImportFileBrowse_Filter { get; }` - File dialog filter: `"DataPRO DB XML File (*.dbxml)|*.dbxml|All Files (*.*)|*.*"`.
|
||
|
|
- `static string ImportView_Browse { get; }` - Label: `"Browse"`.
|
||
|
|
- `static string ImportView_File { get; }` - Label: `"File"`.
|
||
|
|
|
||
|
|
### 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`, `System.Resources`, `System.Globalization`.
|
||
|
|
- **Depended on by**: Unclear from source alone; presumably XAML files in the DBImportExport module.
|
||
|
|
|
||
|
|
### Gotchas
|
||
|
|
- The `TranslateExtension` implementation is nearly identical to the one in `DataPRO/Modules/ISO/ExtraProperties/Resources`. This is code duplication; consider extracting to a shared localization library if maintenance becomes an issue.
|
||
|
|
- The `NotFound` constant value `"#stringnotfound#"` is duplicated verbatim from the ISO ExtraProperties module.
|
||
|
|
- The `StringResources` class is auto-generated; manual edits will be lost when the `.resx` file is regenerated.
|
||
|
|
|
||
|
|
---
|