[Mono-list] Resource System Proposal

Alexander Klyubin klyubin@aqris.com
Sat, 17 Nov 2001 11:52:42 +0000


I personally believe that introducing a C# keyword for retrieving 
localized strings is not a good idea even if it were in the ECMA spec. 
The idea of .NET is that you are not bound to a particular language. 
Accordingly, if C# has some built in features for i18n these have to be 
available in VB.NET and other languages. How can they be made available? 
Probably by some assembly/package like System.I18N because all .NET 
languages support calling methods of classes. So, we get back to the 
point where we have System.I18N.GetLocalizedString or something AND also 
a C# shortcut for it. Think about developers who's primary language is 
not C# but, say, VB.NET, when they look at your C# code and wonder what 
_("Greeting") means.

Now, most Java IDEs support abbreviation expansion. For instance, if you 
type "npe" and then press some key it will be expanded to 
NullPointerException. I envision that most .NET IDEs will have this 
feature too. I think you can  follow me that it won't be hard to define 
a "_" abbreviation that will expand to System.I18N.GetLocalizedString().

_ as keyword has one more disadvantage: you cannot override it. No 
generic i18n is perfect. Hence, you usually end up customising it for 
you needs. If you cannot override _ keyword you will write your own 
class/method anyway.

Still, I understand that writing _("Greeting") saves space and makes 
code more readable to people *used* to this shorthand.


A remark about putting _ or something like that as method to 
System.Object. Inheritance is in no way meant for making shortcuts like 
this. Getting localized string is in no way a property of each and every 
object in .NET. It would be normal if you had an object like 
LocalizedStrings and there you'd have this method, but not every object.
Can you tell me the difference between "This is a string"._("Greeting") 
and (new Integer(13))._("Greeting") and this._("Greeting")? Should there 
be any?

Regards,
Alexander Klyubin