LocalizationManager 1.0.0

dotnet add package LocalizationManager --version 1.0.0
                    
NuGet\Install-Package LocalizationManager -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LocalizationManager" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LocalizationManager" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="LocalizationManager" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LocalizationManager --version 1.0.0
                    
#r "nuget: LocalizationManager, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LocalizationManager@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LocalizationManager&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=LocalizationManager&version=1.0.0
                    
Install as a Cake Tool

📖 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 mvvm namespace 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}
  • cultureInfo
    • null → 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

  1. Go to MyApp → Resources
  2. Create a folder called Login
  3. 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 using ResourceWriter.
A helper method for this will be added in a future release.


Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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