I'm currently using a .resx file at my projects to contain my friendly client's messages. I'm reading from this file via ResourceManager class which allows me to supply consistent messages at my GUI layer, e.g for every successful delete in my application you'll get the same message format "The {0} was deleted successfully" - in my "Workers" form you'll see The worker was deleted successfully and in my "Cars" form you'll see The car was deleted successfully;
I've encounter the SR (String Resource) Generator a week ago and I thought to give it a try. So, what is SR generator ?
" This custom tool allows the generation of a resource class (and optionally .resx file) from either a .resx file, or the Microsoft SR.strings file. "
I think that a simple example will show the tool's capabilities.
[strings] Worker = Worker ItemDeleted(string itemName) = The {0} was deleted successfully. ItemAdded(int itemId, string itemName) = The {1} was added successfully, it's new ID is: {0}.
[strings.he] Worker = עובד ItemDeleted(string itemName) = ה{0} נמחק בהצלחה. ItemAdded(int itemId, string itemName) = ה{1} נוסף בהצלחה, מספרו החדש {0}.
You can put this code in your Global.asax.cs in Application_Start method or change it at any time, according to your needs.
This tool is a MUST in my opinion for two main reasons:
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2009, Oren Ellenbogen
<= Contact me via E-mail
newtelligence dasBlog 2.2.8279.16125