I'm using Drupal 7 with CKEditor module which permit to insert smiley from editor. I've found that the source code of CKEditor fix the smiley description in JS :

config.smiley_descriptions = [
    'smiley', 'sad', 'wink', 'laugh', 'frown', 'cheeky', 'blush', 'surprise',
    'indecision', 'angry', 'angel', 'cool', 'devil', 'crying', 'enlightened', 'no',
    'yes', 'heart', 'broken heart', 'kiss', 'mail'

So when I insert a smiley, the code will be

<img alt="laugh" height="23" src="//cdn.ckeditor.com/4.4.3/full-all/plugins/smiley/images/teeth_smile.png" title="laugh" width="23">

But I want to modify the language of alt and title attributs according to the language used in my site. Is it possible to do that? Thanks in advance.

  • Did you finally work it out? Dec 14 '14 at 18:56

Never tried but I'm pretty sure that's possible.

If you use the ckeditor module, you can alter JS settings through PHP with hook_ckeditor_settings_alter.

Knowing that, it becomes pretty easy to wrap all strings with the t() function:

function yourmodule_ckeditor_settings_alter(&$settings, $conf) {
  foreach ($settings['smiley_descriptions'] as $key => $smiley) {
    $settings['smiley_descriptions'][$key] = t($settings['smiley_descriptions'][$key]);

If you use the wysiwyg_ckeditor module, you can use hook_wysiwyg_plugin. That's pretty much the same thing, you can find a pretty good example on how to use this hook here.

Again, the code hasn't been tested, but it should be a good starting point ;).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.