[Mono-devel-list] New CorlibResourceManager.cs and reworked Locale.cs

Kornél Pál kornelpal at hotmail.com
Wed Jun 8 08:31:03 EDT 2005


CorlibResourceManager is a ResourceManager subclass intended to be used by
Locale.cs of corlib to avoid infinite GetString recursion because GetString
uses methods and classes that use GetString and this may cause recursion in

Locale.cs is a reworked version of the current Locale.cs. I did not use a
diff file because there are about 5 different Locale.cs versions in the
Class Library and all of them can be replaced with this one.

Note that altought the current Locale.cs is created by two authors (Miguel
de Icaza and Andreas Nahr) it usually contains a single GetText method that
returns the string passed as argument.

Some version contain a second GetText method that does formatting as well.

Managed.Windows.Forms has a GetResource method that wraps

Altough I don't like gettext () style resource management it is planed to be
used by Mono Class Library.

This new Locale.cs contains a ResourceManager subclass that returns the
identifier in GetString for the neutral culture but uses resources for
GetObject and all other cultures.

Note that Locale.cs of corlib would use CorlibResourceManager instead of
ResourceManager as the base of GetTextResourceManager.

Altought currently using gettext () style resource management is easier
because Mono is not localized to any language other than English I do not
recommed using is because the following reasons:

Every modified character in English text has to be modified in all of the
other languages as well. This prevents distributing satellite assemblies
separately or using satellite assemblies that are not very up to date.
Furthermore it is wasting of disk space as identifiers are stores as UTF-16
while texts are stored as UTF-8. On the other hand it has better performance
on English messages because they are not looked up in a Hashtable but I
think it has too much disadvantages compared to this small advantage.

>From the current point of view of globalization both methods are the same
because localizable string has to be collected but this will change at
localization time.

I know that gettext () is widely spreaded on Linux but this does not have to
mean that it is the best solution and the Class Library has it's own
infrastructure for globalization using identifier based resources and
culture based resource files.

Comments are welcome about the two new files and gettext () style

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CorlibResourceManager.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050608/201d07e2/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Locale.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050608/201d07e2/attachment-0001.pl 

More information about the Mono-devel-list mailing list