I finally managed to write up my data driven localization resource provider for ASP.NET as an article. It ended up being quite a task getting it all to fit into an article and I actually ended up with TWO freaking articles - one an introduction and one for the resource provider and editor implementation. <s> Yeah, yeah my verbosity gets the best of me.
You can find the Resource Provider/Editor article here:
And the Intro article here:
There are also online samples you can play with to check out the provider here:
and yes you can change the UI in this sample, so behave yourselves. (I know you won't!)
And documentation for the Provider and related tools:
The provider comes with all source code and samples so you can play with this stuff for yourself.
The resource provider is pretty cool and it's been one of those fun side projects I've been tinkering with off and on. I had to dust it of a bit a couple weeks ago for a presentation at the Portland .NET User group and it went well. I love showing this provider because it's fun to watch people get that surprised look on their face as they are editing resources in real time on an ASP.NET form <s>.The session stuff is alright, but this is really the kind of topic that benefits from having a backing article that explains what the heck is going on. Provider Models and ResourceManagers aren't easily explained and the paper should help put things in proper perspective.
Anyway, here are a few screen shots from the editor that's utilizing the data driven localization provider.
Here's the resource editor that can be used to edit resources and refresh them as the application is running.
The form's mostly AJAX driven (except some of the import and renaming operations which require full UI refreshes anyway) so it's very interactive. This is one case where a regular Postback API probably wouldn't have worked well. As you can see the tool has grown a bit from its early days - you can now import Resx resources into the data resource provider, edit resources and run with it, and when you're done optionally write all the resources back out to Resx files.
Other windows kind of pop up ontop so when you add resources or do things like run the translation dialog:
you stay in the current context. The translation dialog is more for inspiration than anything - the translations are worthless to use as is, but they actually help me with my rusty German (you can give me shit for the German translations of the UI) in giving my memory a little jog. But it'd be easy enough to integrate other more sophisticated translation tools into the admin interface.
But one of the most useful features of this toolset is the context sensitive help lookup which basically lets you select a control and jump straight to a matching resource:
This works with Implicit Resources in ASP.NET and tries to look up the control by its control Id and find a matching property. Even if it doesn't match exactly it often can figure out a close match that gets you close in the listbox. To me the biggest hassle in localization is finding the damn resource item in the list of items. I localized the Resource Admin form which is not very large, but it has 225 resource entries total with 157 of them for the Invariant Culture.
How do I know that - ah, but it's a database table <s>. Nothing like being able to run a SELECT statement over your resource data to filter and manipulate it <s>...
If you have questions or comments you can leave them here or, for more involved discussions post it on the message board:
Other Posts you might also like