Portage
single ebuild can prepare several local nuget packages for LINGUAS
and ebuild can configure application (in compile time) to use some language using LANG variable
(see http://superuser.com/questions/370228/how-do-i-add-global-environment-variables-in-gentoo).
LANG="ru-RU.UTF-8"
or even better in runtime, if application supports this. Mono supports.
NuGet
docs.nuget.org/release-notes/nuget-1.8#satellite-packages-for-localized-resources
NuGet >= 1.8 supports the ability to create separate packages for localized resources, similar to the satellite assembly capabilities of the .NET Framework. A satellite package is created in the same way as any other NuGet package with the addition of a few conventions:
- The satellite package ID and file name should include a suffix that matches one of the standard culture strings used by the .NET Framework.
- In its .nuspec file, the satellite package should define a language element with the same culture string used in the ID
- The satellite package should define a dependency in its .nuspec file to its core package, which is simply the package with the same ID minus the language suffix. The core package needs to be available in the repository for successful installation.
To install a package with localized resources, a developer explicitly selects the localized package from the repository. At present, the NuGet gallery does not give any kind of special treatment to satellite packages.
GettextResourceManager
http://www.gnu.org/software/gettext/manual/csharpdoc/GNU_Gettext_GettextResourceManager.html
https://www.gnu.org/software/gettext/manual/html_node/C_0023.html
a .dll file containing a subclass of GettextResourceSet, which itself is a subclass of ResourceSet
the .dll format is a binary file that is compiled from .cs source code and can support plural forms (provided it is accessed through the GNU gettext API).
To convert a PO file to a .resources file, the msgfmt program can be used with the option ‘--csharp-resources’.
To convert a .resources file back to a PO file, the msgunfmt program can be used with the option ‘--csharp-resources’.
PublicResXFileCodeGenerator
a specialized compiler being used (custom Tool property) on the .resx files (ResXCodeGen)
The name of the class is generated as follows:
{project namespace}{folder structure}{filename}.resx (.resx is NOT part of the generated name)
native C#/.NET internationalization mechanism
(namely the classes ResourceManager and ResourceSet)
Applications use ResourceManager methods to retrieve the native language translation of strings.
The instance of this class is accessible through the generated class's ResourceManager property.
Internally, the generated class uses an instance of the ResourceManager class, which is defined in the System.Resources namespace.
if you use generated code from the resx-Files all it does is the following:
public static string MyResourceName {
get {
return ResourceManager.GetString("MyResourceName", resourceCulture);
}
}
This is great, since you get Compile-Time validation of your resource-names for free.
The ResourceManager loads and accesses ResourceSet instances as needed to look up the translations.
(Class: ResourceSet, Assembly: Mscorlib.dll, Namespace: System.Resources)
An instance of ResourceSet is the in-memory representation of a message catalog file.
The ResourceSet class enumerates over an IResourceReader, loading every name and value, and storing them in a Hashtable. A custom IResourceReader can be used.
.resources files and .dll files are two formats that can be directly loaded by the C# runtime into ResourceSets.
This only affects whether a file system access is performed to load the message catalog; it doesn’t affect the contents of the message catalog.
.resources files can also be embedded in .exe files.
ASP .NET MVC
http://stackoverflow.com/questions/192465/how-to-localize-asp-net-mvc-application
resgen
The .resources format is a binary file usually generated through the resgen or monoresgen utility.
the resgen program is from the pnet package, the monoresgen program is from the mono/mcs package (in year 2004). These programs can also convert a .resources file back to a PO file.
# which resgen
/usr/bin/resgen
# file /usr/bin/resgen
/usr/bin/resgen: POSIX shell script, ASCII text executable
# cat /usr/bin/resgen
#!/bin/sh
exec /usr/bin/mono $MONO_OPTIONS /usr/lib/mono/4.5/resgen.exe "$@"
PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
# qfile /usr/lib/mono/4.5/resgen.exe
dev-lang/mono (/usr/lib/mono/4.5/resgen.exe)
https://github.com/mono/mono/tree/master/mcs/tools/resgen
https://github.com/gentoo/dotnet/blob/master/dev-lang/mono/mono-4.2.2.30.ebuild#L109