[Mono-devel-list] Small change in handling string localization

Andreas Nahr ClassDevelopment at A-SoftTech.com
Thu Jul 17 07:03:43 EDT 2003


No, I'm not going to start again with the old thing ;)

Only a small change:
Right now the Locale class resides inside the System.Globalization
namespace.

I would do the following:
Move Locale class to the Assembly directory (where available) and remove the
namespace for Locale class
This has the following advantages:
1. You can use Locale.GetText from any class without having to add a using
System.Globalization statement (we would have to add this to every class
that wants to localize something, which will be practically every class in
some namespaces.
2. We get rid of the System.Globalization namespace which does natively only
exist in corlib, but in no other assemblies.

If nobody objects I'll make the change for the system assembly (The change
should not break existing code)

Andreas



This is the new Locale class (I also sealed it and added a private
constructor):

//
// Locale.cs
//
// Author:
//   Miguel de Icaza (miguel at ximian.com)
//
// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com)
//

internal sealed class Locale {

 private Locale ()
 {
 }

 /// <summary>
 ///   Returns the translated message for the current locale
 /// </summary>
 public static string GetText (string msg)
 {
  return msg;
 }
}




More information about the Mono-devel-list mailing list