Opened 13 years ago

Closed 13 years ago

#946 closed defect (fixed)

__dlg_translate ignore input button labels

Reported by: caugb Owned by: akaEdge
Priority: normal Milestone:
Component: Documentation Version:
Severity: normal Keywords:
Cc:

Description (last modified by caugb)

dlg_translate translates the BUTTON element, but ignore the inputs with type attribute set to button|reset|submit - and it should be translated too.

Here is the function with some new lines, added to correct it.

function __dlg_translate(context) {
  var types = ["input", "select", "legend", "span", "option", "td", "th", "button", "div", "label", "a", "img"];
  for (var type = 0; type < types.length; ++type) {
    var spans = document.getElementsByTagName(types[type]);
    for (var i = spans.length; --i >= 0;) {
      var span = spans[i];
      if (span.firstChild && span.firstChild.data) {
        var txt = Xinha._lc(span.firstChild.data, context);
        if (txt)
          span.firstChild.data = txt;
      }
      if (span.title) {
        var txt = Xinha._lc(span.title, context);
        if (txt)
          span.title = txt;
      }
      // here is...
      if (span.tagName.toLowerCase() == 'input' && 
          (/^(button|submit|reset)$/i.test(span.type))) {
        var txt = Xinha._lc(span.value, context);
        if (txt)
          span.value = txt;
      }
    }
  }
    document.title = Xinha._lc(document.title, context);
}

Change History (2)

comment:1 Changed 13 years ago by caugb

  • Description modified (diff)

comment:2 Changed 13 years ago by ray

  • Resolution set to fixed
  • Status changed from new to closed

[721] -- Good idea :)

Note: See TracTickets for help on using tickets.