coderifous / jquery-localize

a jQuery plugin that makes it easy to internationalize your web site.
465 stars 142 forks source link

Allow html tag in localization #34

Closed hueitan closed 9 years ago

hueitan commented 10 years ago

what else If we need

<a href="...">...</a>

inside?

Better If this can be allowed.

coderifous commented 10 years ago

I don't understand your question. Do you want to localize both the text of the link, and the value of the href attribute?

hueitan commented 10 years ago

value of href

thanks

filippoferri commented 9 years ago

I have same question, if I have

<a href="...localizeUrl ...">...localizeText ...</a>

and I want to localize both?

Thanks

hueitan commented 9 years ago

@filippoferri I have tried this before, seems this doesn't work in this case.

filippoferri commented 9 years ago

@huei90 maybe I solved:

Line 137 - Added this:

} else if (elem.is('a')) {
        localizeHrefElement(elem, key, value);

Line 69 - added this code:

    //Localize A href
    localizeHrefElement = function(elem, key, value) {
      setAttrFromValueForKey(elem, "href", value);
      return setAttrFromValueForKey(elem, "a", value);
    };

In .json file:

"Link": {
    "href": "localizeUrl", 
    "text": "localizeText"
  },

The explanation is terrible I know, but the result looks good

hueitan commented 9 years ago

Cool! This is a good idea! ! On Oct 12, 2014 1:16 AM, "Filippo Ferri" notifications@github.com wrote:

@huei90 https://github.com/huei90 maybe I solved:

Line 137 - Added this:

} else if (elem.is('a')) { localizeHrefElement(elem, key, value);

Line 69 - added this code:

//Localize A href
localizeHrefElement = function(elem, key, value) {
  setAttrFromValueForKey(elem, "href", value);
  return setAttrFromValueForKey(elem, "a", value);
};

In .json file:

"Link": {

"href": "localizeUrl",

"text": "localizeText"

},

The explanation is terrible I know, but the result looks good

— Reply to this email directly or view it on GitHub https://github.com/coderifous/jquery-localize/issues/34#issuecomment-58756996 .