Does anyone have an idea about using the .js translations?

I've seen a thread on the Plupload forum about this and tried to apply it with Drupal. I've created a little module which adds the language file, but no matter what my module's weight is, I can't bring the necessary .js file after the .js files loaded by Plupload.

(I've chosen to make a module for this purpose because
a) to be strict, this should be done with the Plupload integration module - at least I was able to tell Drupal that Plupload is a required module for it's translation, which is quite obvious anyway...
b) I don't want to mess up my theme with i18n code. )

Comments

scorchio’s picture

Okay, so I've modified my module to use $scope = 'footer' for adding the translation .js.

It works now, but still, I would like to load the translation only when it's needed. Any ideas about that?

Nikita Petrov’s picture

You may use you'r template.php file and hook "preprocess_page" like this:

function YOURTHEME_preprocess_page(&$vars, $hook) {
  global $theme_path;
  if (arg(0)=='node' && arg(2)=='upload')
  {
	$vars['footer'] .= '<script src="' . base_path() . $theme_path . '/js/plupload-translation.js"></script>';
  }
}

so, after that you must add in your_theme/js/ folder plupload-translation.js like this:

plupload.addI18n({
        'Select files' : 'in your language here',
        'Add files to the upload queue and click the start button.' : 'in your language here',
        'Filename' : 'in your language here',
        'Status' : 'in your language here',
        'Size' : 'in your language here',
        'Add files' : 'in your language here',
    'Start upload':'in your language here',
        'Stop current upload' : 'in your language here',
        'Start uploading queue' : 'in your language here',
        'Drag files here.' : 'in your language here'
});

enjoy!

workonwomen’s picture

Title: How to use Plupload UI translations? » What is wrong with my plupload translation?

My developing page is using plupload what I try to translate:
http://new2.go-na.hu/new2/hu/content/galeria

If you check the source, what is wrong, why do I see no translation on my latest Drupal 7 plupload?

workonwomen’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

(Just changing the version to 7)

infojunkie’s picture

slashrsm’s picture

Status: Active » Closed (duplicate)