On a Drupal 7.1 installation with several languages ("/admin/config/regional/language"), the editor provided by the CKEditor 7.x-1.1 module does not follow the user language (which can be setup by the user via "/user").

The editor still uses english only for the icons captions.

CKEditor in configured via "/admin/config/content/ckeditor/edit/Full", and the setup done is :
- Language : English
- Auto-detect language : Enabled

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dczepierga’s picture

Status: Active » Postponed (maintainer needs more info)

CKEditor library not using user defined language in Drupal, but auto-detect user browser language and use it - so if u try to check this in browser with english language u will get this language in the editor, if u have browser with german language u also will have CKEditor translated to german language...

We never get feature request issue to do something like this, but i don't know does it needed here in this case?
Maybe other people say what they think about feature like this...

Greetings

Levure’s picture

In my opinion (but this is only my opinion), it would make sense to use the user defined language in Drupal since Drupal offers that feature (and it would several different language detection in a same CMS).

Thus, many people are ignoring the fact they can setup their prefered language page in browser settings.

I don't say you have to (because this is your module, not mine), drop auto-detect user browser language and use only user defined language in Drupal.

I think the solution would be to add a select box (or radio) to allow choosing the prefered user language detection :
- Browser language
- User language Drupal setting

Default setting should then be "Browser language" to avoid breaking existing setup.

As said by dczepierga : other people opinions are welcome !

Regards,

Levure’s picture

Can you tell if the implementation of that feature would take a lot of time ?

If you can give some tips (for example, where it is possible to change CKEditor configuration settings before the editor is rendered), I could implement them, or build another module.

I see something like this :
- If the language detection is set on "Browser language", no changes
- If the language detection is set on "User language Drupal setting", I would disable auto-detect and force the editor language with the Drupal user language.

Regards,

caiosba’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
2.26 KB

Hi,
I can see that it also happens on Drupal 6.
The CKEditor only gives you two options to deal with localization:
Force a language, that you can choose, or auto-detect the browser
language.
I've added one more option, to get the Drupal language.
Patch is attached.

soulfroys’s picture

@caiosba, thanks for the patch!!! It worked smoothly.

[EDITED]
Sorry, I forgot this important information:
CKEditor 6.x-1.x-dev (2012-Jan-05)
CKEditor (library) 3.6.2

soulfroys’s picture

mkesicki’s picture

@soulfroys thank you for review.

infojunkie’s picture

Version: 7.x-1.1 » 6.x-1.9
Status: Needs review » Reviewed & tested by the community
Levure’s picture

@caiosba, thanks for the work done !

MarkU’s picture

The same problem arises with CKEditor installed via the WYSIWYG module - can anyone help me out ?

On a site with multilingual content, and hence authors contributing in a variety of languages, it is really very important that the editor interface reflects each authors preferred language.

Thanks,

(I'm new to Drupal by the way)

soulfroys’s picture

Please... Will this patch be committed?
[EDITED]
Need to be fixed in D7 first...

soulfroys’s picture

Re-rolled against the latest dev (2013-Jan-11).
Credits: @caiosba in #4).

soulfroys’s picture

Status: Reviewed & tested by the community » Needs review

Well, I tried making the porting but no success... :(

heyyo’s picture

Version: 6.x-1.9 » 7.x-1.x-dev
StephenN’s picture

d7 port against 7.x-1.13, very lightly tested

heyyo’s picture

I just tested your patch StephenN works great for me. Thanks.

martichka5’s picture

Hi, everyone!
We have the same problem that ckeditor language detection is enabled but does not work. All plugin labels stay untranslated.
After research i've committed patch with two small changes.
The first one is in the ckeditor.lib.inc file. There is a check if auto-language detection is off, but the problem is that they do nothing in the other case. So, i added else statement that assigns the current site language from the global language variable.

The second change is in the media plugin.js file. We need this plugin label translated. So, our solution was to add Drupal.t function to media plugin label and to update .po file with the needed string. The last was necessary because this js file is executed dynamically and the string was not recorded to the database and then did not appear in the translation interface.

bwaindwain’s picture

Issue summary: View changes

In our multilingual site, we needed to be able to set the CKEditor UI and contents languages independently. CKEditor has a contentsLang and contentsLangDirection setting. At /admin/config/content/ckeditor, edit your profile and in the "Advanced Options > Custom JavaScript configuration" add the lines:

config.contentsLanguage = document.getElementById(textarea_id).lang;
config.contentsLangDirection = document.getElementById(textarea_id).dir; 

As long as the textarea has the correct language and direction attributes set, CKEditor will now match.

FYI: Set your form element attributes with #attributes

tobiberlin’s picture

The Patch in #15 worked for me with version 7.x-1.17.

markdc’s picture

Patch #17 is working for me on the latest version. I now have language-aware wysiwyg. Thanks!

However, it fails to apply to plugins/media/plugin.js. It seems to not affect the functionality of the patch though.

EDIT

Went with patch #15 instead. It still applies cleanly and offers a config option for language detection (browser language or Drupal language). Working perfectly. Thank you!

pawel.traczynski’s picture

For me this works:

  if ($conf['auto_lang'] == "f") {
    $settings['language'] = $conf['lang'];
    //#1473010: [D7] Spell checker set to use interface language
    $settings['scayt_sLang'] = ckeditor_scayt_langcode($conf['lang']);
  }
  ### PATCH START ###
  else {
    $settings['language'] = $language->language;
  }
  ### PATCH END ###

file: ckeditor/includes/ckeditor.lib.inc

  • vokiel committed 788710e6 on 7.x-1.x
    Issue #1203846 by soulfroys, StephenN, martichka5, caiosba: CKEditor...
vokiel’s picture

Status: Needs review » Fixed

Applied patch #15 with minor update for MediaEmbed plugin.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.