Add translation support in common.js

Created on 22 November 2016, about 8 years ago
Updated 28 December 2024, 6 days ago

Hello, in the function toggle_filedetails and makeAJAXLoadFileDetails you might implements the Drupal.t() function for the changes of the innerHTML of the link names.

old :

function toggle_filedetails(e) {
  if (Dom.get('editfiledetailslink').innerHTML == 'Display') {
    //YAHOO.log('toggle_filedetails - none ');
    Dom.setStyle('displayfiledetails', 'display', '');
    Dom.setStyle('editfiledetails', 'display', 'none');
    Dom.get('editfiledetailslink').innerHTML = 'Edit';
  } else {
    //YAHOO.log('toggle_filedetails - block');
    Dom.setStyle('displayfiledetails', 'display', 'none');
    Dom.setStyle('editfiledetails', 'display', '');
    Dom.get('editfiledetailslink').innerHTML = 'Display';
  }
}

and old :

var makeAJAXLoadFileDetails = function(id) {
  closeAlert();
  var reportmode = document.frmtoolbar.reportmode.value;
  YAHOO.container.filedetails.focusFirst();
  Dom.get('displayfiledetails').innerHTML = '';
  YAHOO.container.menuBar.cfg.setProperty("visible",true);
  YAHOO.container.filedetails.cfg.setProperty("visible",true);
  YAHOO.container.filedetails.cfg.setProperty("fixedcenter",false);
  document.frmFileDetails.description.value = '';
  document.frmFileDetails.version_note.value = '';
  document.frmFileDetails.editfile_tags.value = '';
  Dom.setStyle('displayfiledetails', 'display', 'block');
  Dom.setStyle('editfiledetails', 'display', 'none');
  try {
    Dom.get('editfiledetailslink').innerHTML = 'Edit';
  } catch (e) {}
...

become :

function toggle_filedetails(e) {
  if (Dom.get('editfiledetailslink').innerHTML == Drupal.t('Display')) {
    //YAHOO.log('toggle_filedetails - none ');
    Dom.setStyle('displayfiledetails', 'display', '');
    Dom.setStyle('editfiledetails', 'display', 'none');
    Dom.get('editfiledetailslink').innerHTML = Drupal.t('Edit');
  } else {
    //YAHOO.log('toggle_filedetails - block');
    Dom.setStyle('displayfiledetails', 'display', 'none');
    Dom.setStyle('editfiledetails', 'display', '');
    Dom.get('editfiledetailslink').innerHTML = Drupal.t('Display');
  }
}

and :

var makeAJAXLoadFileDetails = function(id) {
  closeAlert();
  var reportmode = document.frmtoolbar.reportmode.value;
  YAHOO.container.filedetails.focusFirst();
  Dom.get('displayfiledetails').innerHTML = '';
  YAHOO.container.menuBar.cfg.setProperty("visible",true);
  YAHOO.container.filedetails.cfg.setProperty("visible",true);
  YAHOO.container.filedetails.cfg.setProperty("fixedcenter",false);
  document.frmFileDetails.description.value = '';
  document.frmFileDetails.version_note.value = '';
  document.frmFileDetails.editfile_tags.value = '';
  Dom.setStyle('displayfiledetails', 'display', 'block');
  Dom.setStyle('editfiledetails', 'display', 'none');
  try {
    Dom.get('editfiledetailslink').innerHTML = Drupal.t('Edit');
  } catch (e) {}
...
📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • JavaScript

    Affects the content, performance, or handling of Javascript.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024