jQuery.x18n
jQuery.x18n copied to clipboard
Updating 'title' attributes
What about possibility of updating a title attribute of an element? A dictionary entry reference could be set with data-t-title="..." attribute.
PS. Thanks for the very useful lib!
Yep, this is on my roadmap for v1.2! However I probably won't use data-t-title. To support all attributes in general that would mean I would have to loop through all attributes, and if I remember correctly it's tricky to get all attributes of an element.
Ideally the data attributes should allow to specify interpolation and plurals, too. I thought of something like this:
-
data-attributes="title,placeholder" data-t-title="..." data-t-title-plural="..."(Looks fordata-t-titleanddata-t-placeholder - Same as above, but instead of
data-attributesa global$.x18n.attributesarray that specifies the attributes to look for. -
data-attributes='{ "title": { "key": "...", "plural": "...'" } }'(JSONified object inside ofdata-attributes)
I didn't like any of those solutions, so I didn't implement it until I find something better. :/ Got a better idea?