LocalizationManager 1.0.0
dotnet add package LocalizationManager --version 1.0.0
NuGet\Install-Package LocalizationManager -Version 1.0.0
<PackageReference Include="LocalizationManager" Version="1.0.0" />
<PackageVersion Include="LocalizationManager" Version="1.0.0" />
<PackageReference Include="LocalizationManager" />
paket add LocalizationManager --version 1.0.0
#r "nuget: LocalizationManager, 1.0.0"
#:package LocalizationManager@1.0.0
#addin nuget:?package=LocalizationManager&version=1.0.0
#tool nuget:?package=LocalizationManager&version=1.0.0
📖 LocalizationManager 📖
The LocalizationManager was originally created to handle resources and languages in WPF applications in a clean and MVVM-friendly way.
This README will guide you step by step through the setup and usage of the library 🚀
📦 Installation
Open your project terminal and run:
dotnet add package Cacx.LocalizationManager --version latest
💻 Usage Guide
✅ Step 1 – XAML Setup
Go to your Window.xaml and declare the required namespaces:
xmlns:designLoc="clr-namespace:Cacx.LocalizationManager.Core;assembly=Cacx.LocalizationManager"
xmlns:mvvm="clr-namespace:SampleProject.MVVM"
⚠️ The
mvvmnamespace depends on your project structure.
You should use MVVM for this library to work optimally.
🧩 DataContext Setup
Add a design-time DataContext so the designer can show preview values:
<d:Window.DataContext>
<designLoc:DesignTimeWindowContext/>
</d:Window.DataContext>
Then set the runtime DataContext (optional if done in code):
<Window.DataContext>
<mvvm:MainWindowMVVM/>
</Window.DataContext>
🧠 Step 2 – MVVM Setup
Inside your ViewModel, add and initialize the LocalizationProvider:
public LocalizationProvider Loc { get; }
public MainWindowMVVM()
{
// We will explain the constructor parameters in the next step
Loc = new LocalizationProvider(
resourceName: "SampleProject.Resources.MainWindow.MainWindow",
cultureInfo: null
);
}
📂 Step 3 – Resource Folder Structure
This tutorial assumes the following structure:
MyApp (Project)
└─ Resources
├─ Login
│ ├─ Login.resx
│ └─ Login.de-DE.resx
└─ CreateAccount
├─ CreateAccount.resx
└─ CreateAccount.de-DE.resx
🧠 Important concept:
Each subfolder represents a context (usually a Window or View).
📌 Resource Name Convention
new LocalizationProvider(
resourceName: "SampleProject.Resources.Login.Login",
cultureInfo: null
);
Grammar:
{ProjectName}.{ResourcesFolder}.{ContextFolder}.{BaseResxName}
cultureInfonull→ system default language 🌍- or a specific
CultureInfo(e.g.de-DE)
🔗 Step 4 – XAML Binding
You can now bind localized strings in XAML:
<TextBlock Text="{Binding Loc[WelcomeMessage]}" />
⚠️ Important
XAML bindings only support strings.
If you need:
- Streams
- Images
- Other objects
➡️ You must retrieve them via code.
📝 Step 5 – Creating the RESX Files
Example: Login Context
- Go to
MyApp → Resources - Create a folder called
Login - Create:
Login.resx(base file)Login.de-DE.resx(German)
Add the same keys to all files and translate their values 🌐
🎉 Setup Complete!
Your localization system is now fully working 🚀
✨ Additional Features
The LocalizationProvider offers several useful methods:
void UpdateContext(string resourceName);
🔄 Changes the active context (resource file)
void UpdateCulture(CultureInfo culture);
🌍 Switches the language (same context)
CultureInfo GetCulture();
📌 Returns the current culture
Stream GetStream(string key);
📂 Retrieves a stream from the resource file
object GetObject(string key);
📦 Retrieves an object from the resource file
⚠️ Objects cannot be added via the RESX GUI.
They must be added via code usingResourceWriter.
A helper method for this will be added in a future release.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 96 | 1/15/2026 |