jQuery.x18n icon indicating copy to clipboard operation
jQuery.x18n copied to clipboard

Updating 'title' attributes

Open mefjuu opened this issue 13 years ago • 1 comments

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!

mefjuu avatar Feb 08 '13 08:02 mefjuu

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 for data-t-title and data-t-placeholder
  • Same as above, but instead of data-attributes a global $.x18n.attributes array that specifies the attributes to look for.
  • data-attributes='{ "title": { "key": "...", "plural": "...'" } }' (JSONified object inside of data-attributes)

I didn't like any of those solutions, so I didn't implement it until I find something better. :/ Got a better idea?

florian avatar Feb 08 '13 10:02 florian