If you look for internationalization it's common to use the abbreviation i18n. Internationalization is the topic of translation of messages. If you are interested in using different units, date formats, number notations that's called Localization L10n.
Things to look at:
- Libraries
:
- http://www.mono-project.com/I18N_with_Mono.Unix Based on the posix standard. Uses gettext library to get translations.
- Castle Framework MonoRail Resources and Localisation
- Spring.Net, localization for web applications
- GetText: http://www.gnu.org/software/gettext/manual/gettext.html#Introduction
- Example .NET applications available with sources where localization is implemented nicely:
- SharpDevelop - check user interface translated to many languages
- Paint.NET
- MonoDevelop, source code can be checked out using the following command line: svn co svn://anonsvn.mono-project.com/source/trunk/monodevelop monodevelop
Overview Examples
Example |
Localization change |
Method |
Architecture |
---|---|---|---|
SharpDevelop |
runtime |
|
|
Paint.NET |
restart |
|
|
MonoDevelop |
? |
|
? |
Spring.Net |
runtime |
|
- |
MonoRail |
runtime |
|
|
Singleton versus Static Class
- In C#, Singleton class as the name implies creates only one instance of the class and its member, whereas, static class creates a new instance of the static members every time it is being accessed.
- Adds a level of indirection. This allows the creation of more than one instance of the class at a later date without breaking client code.
- Encapsulates data and methods into a separate namespace, the singleton class.
- Allows sub-classing.
- Provides access control to the single instance.
- Thread safe.
Overview Methods
Method |
Maintenance |
Remarks |
---|---|---|
Resources (.NET) |
Satellite assembly: editors -Zeta Resource Editor,Resource Builder |
|
gettext |
The main differences between the common .NET resources approach and the
|
|
DelftLanguage |
text-files(lng) |
|
- More info Internationalization - Open Source vs Microsoft,
Localization of Microsoft NET Applications, Developping Global Applications in Java - Resource.dll <-> PO-files
Suggestion
Architecture
Work method
- Automatic Localization Using Localizers = property window Visual Studio [resource on class (Form/UserControl)s level]
- Applying Resources Manually = resourceService.getString(indexname) for using the Lookup hierarchy.
Lookup hierarchy
- Class (Form/UserControl) languagecode-country/regioncode
- Class (Form/UserControl) languagecode
- Application (Plugin) languagecode-country/regioncode
- Application (Plugin) languagecode
- DelftShell (DelftShell.Resource, a new project in DelftShell for all common translations like save, delete, remove etc.) languagecode-country/regioncode
- DelftShell (DelftShell.Resource, a new project in DelftShell for all common translations like save, delete, remove etc.) languagecode
Maintenance
Conclusion
Since GNU specially offers an LPGL GNU.GetText.dll (get dll) to make a bridge between the .NET resources and gettext files we can use the .NET ResourceManager for managing localized/culture depended resources.
GNU.GetText.dll is derived from the .NET ResourceManger class and has a GettextResourceSet derived from the class ResourceSet.
The Gettext xgettext program extracts translatable strings from given input file(s) into a template (.pot) file.
With PoEdit it's easy to generate culture depended po files and to compile them to .mo files.Dutch translations for PACKAGE package.
Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER
This file is distributed under the same license as the PACKAGE package.
koste_a <EMAIL@ADDRESS>, 2008.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-04-25 09:48+0200\n"
"PO-Revision-Date: 2008-04-25 10:00+0100\n"
"Last-Translator: alex <alex@del.ta.res.nl>\n"
"Language-Team: Dutch\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CP1252\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"#: hello.cs:37
msgid "Hello, world!"
msgstr "Hallo, wereld!"#: hello.cs:44
#, csharp-format
msgid "This program is running as process number
Unknown macro: {0}."
msgstr "Dit programma draait onder processnummer
Unknown macro: {0}."
#: Form1.cs:21
msgid "Dynamic Text by Mono-gettext"
msgstr "Dynamische text door Mono-gettext (is niet waar)"#: Form1.cs:22
msgid "lblResources From gettext.resource"
msgstr "lblResource krijgt zijn tekst van gettext"
Still it's a bit obscure to use gettext in a .NET environment.
In the tests new GettextResourceManager(<domain>) never caused errors by a wrong domain or read the mo files with a correct domain.
(based on setting the Thread.CurrentThread.CurrentUICulture/CurrentCulture)
A point of interest is the convertion of resources.dll into .mo files and back.
The Gettext programs msgfmt and msgunfmt should include these options but I got some errors: 'pnet' should be installed. Compiling 'pnet' resulted in an error 'treecc' should be installed.
'treecc' could not be compiled. Well, still some obstacles has to be removed. ([sources{_}|http://dotgnu.org/pnet-packages.html#mswindows]_)
Points of interest
- Resources and WPF: msd2 (still based on Satellite Resource.dll's]
4 Comments
Unknown User (don)
One more resource editor (available in src): Resourcer from Lutz Roeder
Unknown User (don)
I was thinking about how we can use resources on-the-fly, it may be handy to have some automatic localization string replacements when we send messages using log4net:
... after googling a bit here is the some idea even more advanced
:
In this way all log4net messages can be translated nicely.
Fedor Baart
This is an example of how you edit gettext generated po files

Fedor Baart
I found that the gettext implementation on .Net extends the resource manager. From the translation po files you can generate .net resources in .resource form or in .dll form. http://www.gnu.org/software/gettext/manual/html_node/C_0023.html
This seems like a promising approach.