It's not nice to translate JS snippets manually every time after installation bueditor has been complete.

Comments

ufku’s picture

Status: Active » Closed (won't fix)

Use import/export interface after customizing your editor.

chi’s picture

Status: Closed (won't fix) » Active

Unfortunately, it isn't possible to use this interface in Drupal distributions like Starter.

chi’s picture

I also would like to ask is there any way to translate editors on multi-language site? Is it a good idea to use Drupal.t() function for string translation in the editors?

ufku’s picture

Button titles can be translated by prefixing them with t:. So if you set the title as t:Bold it will be have the result of t('Bold').
For button content, you can either use Drupal.t() for js buttons or t() for php buttons.

chi’s picture

Gabor says that t() is the wrong answer.

ufku’s picture

Then, don't do it.

chi’s picture

Status: Active » Closed (won't fix)

Here is my solution:

/**
 * Bueditor setup callback.
 */
function starter_bueditor_setup() {
  $file = STARTER_PROFILE_PATH . '/includes/starter_bueditor.inc';
  module_load_include('inc', 'bueditor', 'admin/bueditor.admin');
  if ($code = file_get_contents($file)) {
    // Translate editor.
    $code = preg_replace_callback('#<T>.*</T>#',
    create_function(
      '$matches',
      'return t(str_replace(array("<T>", "</T>"), "", $matches[0]));'
    ),
    $code);
    if ($editor = bueditor_exec_editor_code($code)) {
      bueditor_save_import($editor);
    }
  }
  $eid = db_query('SELECT eid FROM {bueditor_editors} WHERE name=\'Starter\' LIMIT 1')->fetchField();
  if ($eid) {
    variable_set('bueditor_user1', $eid);
  }
}

In bueditor.in I have bueditor profile with special tags .

...
var form = [
 {name: \'src\', title: \'<T>Image URL</T>\', required: true, suffix: E.imce.button(\'attr_src\')},
 {name: \'width\', title: \'<T>Width x Heigh</T>t\', suffix: \' x \', getnext: true, attributes: {size: 3}},
 {name: \'height\', attributes: {size: 3}},
 {name: \'alt\', title: \'<T>Alternative text</T>\', required: true}
];
E.tagDialog(\'img\', form, {title: \'<T>Insert/edit image</T>\'});',
      'icon' => 'picture.png',
      'accesskey' => 'M',
      'weight' => '0',
    ),
    1 => 
    array (
      'title' => '<T>Insert/edit link</T>',
      'content' => 'js:
...

It should work fine if you have .po file with translation for this. But I do not know how it will work on l.d.o. So I am closing this.