Python, Firefox programming and Irish Whiskey.

Sunday, March 7, 2010

localized html in a chrome extension

Google Chrome implements a function to get a localized version of a string. Using it to update HTML can be rather tedious if we use the most naive approach I can think of:

Let's do something smarter: We shall mark all tags that contain translatable strings with a class, then we will select all tags of that class, simply take their innerText as the message id, get the message and replace innerText. Done.

Done.

No comments:

Post a Comment