Opened 14 years ago

Closed 14 years ago

#229 closed defect (fixed)

Hyperlink popup: make sure "target" is translated

Reported by: Paul Baranowski <paul@…> Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version:
Severity: normal Keywords:
Cc:

Description

Make sure the "target" dropdown shows a translated string. Add these two lines to the Init() function in /popups/link.html:

  // Make sure the translated string appears in the drop down.
  document.getElementById("f_target").selectedIndex = 1;
  document.getElementById("f_target").selectedIndex = 0;

Context:

function Init() {
  __dlg_translate('HTMLArea');
  __dlg_init();
  
  // Make sure the translated string appears in the drop down.
  document.getElementById("f_target").selectedIndex = 1;
  document.getElementById("f_target").selectedIndex = 0;
  
  var param = window.dialogArguments;
  var target_select = document.getElementById("f_target");
  var use_target = true;
  if (param) {
    if ( typeof param["f_usetarget"] != "undefined" ) {
      use_target = param["f_usetarget"];
    }
    if ( typeof param["f_href"] != "undefined" ) {
      document.getElementById("f_href").value = param["f_href"];
      document.getElementById("f_title").value = param["f_title"];
      comboSelectValue(target_select, param["f_target"]);
      if (target_select.value != param.f_target) {
        var opt = document.createElement("option");
        opt.value = param.f_target;
        opt.innerHTML = opt.value;
        target_select.appendChild(opt);
        opt.selected = true;
      }
    }
  }
  if (! use_target) {
    document.getElementById("f_target_label").style.visibility = "hidden";
    document.getElementById("f_target").style.visibility = "hidden";
    document.getElementById("f_target_other").style.visibility = "hidden";
  }
  var opt = document.createElement("option");
  opt.value = "_other";
  opt.innerHTML = i18n("Other");
  target_select.appendChild(opt);
  target_select.onchange = onTargetChanged;
  document.getElementById("f_href").focus();
  document.getElementById("f_href").select();
};

Change History (2)

comment:1 Changed 14 years ago by gogo

Why are you setting the selectedIndex twice? Why set to 1 and then immediatly change to 0 ?

comment:2 Changed 14 years ago by niko

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

because of a gecko bug, steps to repdoduce:

  1. switch to a language where the targets are translated (german)
  2. open the insert-link dialog
  3. the target will be untranslated
  4. however when you drop-down the select-box you see the translated items!

fixed in changeset:141

Note: See TracTickets for help on using tickets.