Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

SatsuiUi preview

What is SatsuiLocalization ?

SatsuiLocalization is a library containing a translation system i created for my own WPF projects.
You can change the language on the fly.
It's easy, fast to use and free.

How to install it ?

The Nuget package is available here :

PM> Install-Package Messatsu.SatsuiLocalization

How to use it ?

When the Nuget package is installed, instantiate a Translation object then load a XML file or an embed resource containing the language definition :

Translation myLang = new Translation();
// Or myLang.LoadResource("MyProject.Folder.XmlFile.xml");
// Don't forget to set your resource as an embed resource !

You can also use statics functions of the Translation class :

Translation myLang = Translation.FromFile("path-to-the-xml-file.xml");
Translation myLang = Translation.FromResource("MyProject.Folder.XmlFile.xml");

Example of a basic language definition file :

<?xml version="1.0" encoding="utf-8" ?>
<lang name="English" author="SatsuiBird">
		<tb-test>Im a text $ln with a newline !</tb-text>
		<btn-test>Im a test button</btn-test>
		<test-parameter>Your parameter is : $p</test-parameter>
		<test-variable>My variable is : $myvar</test-variable>

Now the language is loaded, you just have to call the Translate function, giving it the control to translate and a XML root element :

// Called from the code-behind of MainWindow.xaml
myLang.Translate(this, "main-window");

So, in the XMAL definition of MainWindow, i just have to set properties as id:

<TextBlock Text="id:tb-test"/>
<Button Content="id:btn-test"/>

Here, tb-test and btn-test are found because we passed main-window as the root element.
But you can access parents elements if you use a slash before the node name :

<TextBlock Text="id:/general/copy"/>

How to access it in the code-behind ?

You can access it with the function GetString givint it the path and an optional parameter :

string result = myLang.GetString("messages/test-parameter", "my parameter");

In the language file, the node test-parameter is defined as "Your parameter is : $p".
So, SatsuiLocalization will replace $p by the parameter passed to GetString and will return "Your parameter is : my parameter".

Add your own variables

As we have seen, SatsuiLocalization use $p and $ln variables, but you can add your own variables.
It's useful when you need to show informations which are not language related, like application name, version, ...
You can do it with the static function AddVar of the Translation class.

Translation.AddVar("myvar", "hello world");

In the language file, the node test-variable is defined as "My variable is : $myvar" :

// Will return : My variable is : hello world
string reuslt = myLang.GetString("messages/test-variable");

Eh, it's not translating my own controls !

If you created your own control with custom properties which are not managed by SatsuiLocalization, you can use the function AddCustomControl. There is an example in DemoWPF.

myLang.AddCustomControl(typeof(YourControlClass), "CustomProperty1", "CustomProperty2", ...);

My others projects

Set of controls and skins for WPF applications

Read and edit applications memory easily

Create customizable HTTP widgets

You can’t perform that action at this time.