48 lines
2.6 KiB
Markdown
48 lines
2.6 KiB
Markdown
---
|
|
source_files:
|
|
- DataPRO/Modules/Database/DatabaseServices/Resources/TranslateExtension.cs
|
|
- DataPRO/Modules/Database/DatabaseServices/Resources/StringResources.Designer.cs
|
|
generated_at: "2026-04-17T16:07:59.007705+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "63cd62f694267ff8"
|
|
---
|
|
|
|
# Resources
|
|
|
|
### Purpose
|
|
This module provides localization resources and a XAML markup extension for the `DatabaseServices` assembly. It enables the resolution of user-facing strings (such as status messages regarding database operations) within the UI layer, supporting both direct code access via a resource manager and declarative access within XAML files.
|
|
|
|
### Public Interface
|
|
**Class: `TranslateExtension`**
|
|
* **Signature:** `public class TranslateExtension : MarkupExtension`
|
|
* **Constructor:** `TranslateExtension(string key)` - Initializes the extension with the resource key to be looked up.
|
|
* **Method:** `public override object ProvideValue(IServiceProvider serviceProvider)` - Resolves the `_key` to a localized string. Returns `#stringnotfound#` if the key is null/empty, or `#stringnotfound# <key>` if the lookup fails.
|
|
|
|
**Class: `StringResources` (Internal)**
|
|
* **Signature:** `internal class StringResources`
|
|
* **Property:** `static ResourceManager ResourceManager` - Provides access to the resource cache.
|
|
* **Property:** `static CultureInfo Culture` - Gets or sets the current UI culture for resource lookups.
|
|
* **Static Properties (Localized Strings):**
|
|
* `string ClearingLocalDb` ("Clearing local db")
|
|
* `string ConnectedTo` ("Connected to: ")
|
|
* `string CopyFromRemoteServer` ("Copy from remote server to local")
|
|
* `string CopyingTable` ("Copying")
|
|
* `string EnablingConstraints` ("Finishing up")
|
|
* `string Local` ("Local")
|
|
* `string Remote` ("Remote")
|
|
* `string SwitchFileNotFound` ("Could not switch to local - File not found:")
|
|
* `string SwitchToLocal` ("Switch to local")
|
|
* `string SwitchToRemote` ("Switch to remote")
|
|
|
|
### Invariants
|
|
* `TranslateExtension` never returns `null`. It guarantees a string return, falling back to error indicators (`#stringnotfound#`) if the resource key is missing.
|
|
* `StringResources` is an auto-generated class; manual modifications will be overwritten by tooling (Visual Studio/ResGen).
|
|
|
|
### Dependencies
|
|
* **Depends on:** `System`, `System.Windows.Markup`, `System.Resources`, `System.Globalization`.
|
|
* **Dependents:** Any XAML UI components within the `DatabaseServices` scope that require localized text.
|
|
|
|
### Gotchas
|
|
* The `StringResources` class is marked `internal`, making it inaccessible outside the `DatabaseServices` assembly.
|
|
* The `Translate |