Before to talk about exact subject of this post I would like to say some words about modality in web applications. As you probably know Phil Haack introduced undoable plugin for jQuery which allows to improve user experience for web apps by getting rid of modal confirm dialogs. You can find demo of this plugin here. I really like that because I think that using of modal dialogs in web applications should be minimized. For me as end user (not as developer) site which implemented with minimum modality looks much more friendly and fun rather then web app with huge amount of modal dialogs. I’m not saying that we should get rid of modal dialog entirely – but we should consider using of more user friendly solutions in those places where modal dialogs aren’t really needed.
Phil’s plugin helps in one of these places: it allows to avoid confirmation dialogs in scenarios where you need to implement a list of deletable items. And it is even more suitable if you need to make deleting cancelable. This is the end of a little preface and now I will describe process of localization of undoable plugin.
Suppose that we have localized web application and we have list of images (table’s header and links texts are on Russian):
We want to make it deletable. The process of creating it via jQuery.undoable plugin is quite straightforward and it is explained in Phil’s post and his demos. I will not repeat it. Just will show the end result:
All is fine except status message which is shown on English and undo link text near it. Localization of status message (The item has been removed) is quite simple: we need to override OTB formatStatus function of undoable plugin:
Here Resources.ImageDeleted is the property from strongly typed Resources.resx file. Now result looks better:
Localization of undo link text is more tricky. Since it is hardcoded in OTB showUndo function without modification of plugin code I didn’t find a better way to fix it rather than overriding the whole showUndo function by copy-paste it from jquery.undoable.js and replace hardcoded “undo” text with resource string (Phil’s plugin is flexible enough and we can override OTB functions by custom ones). The resulting script is the following:
And the final result is what I wanted:
Now we have both status message and undo link text localized. But my opinion is that localization of undo link text is the point of further improvements. Nevertheless thanks to Phil for this plugin.