Change the language in the Tiny MCE editor

Phoca Guestbook - creating guestbooks in Joomla! CMS
webansvarlig
Phoca Enthusiast
Phoca Enthusiast
Posts: 53
Joined: 01 Feb 2008, 03:09

I did something smar

Post by webansvarlig »

I did something smart one time. It changed the language in the TinyMCE to Norwegian. But now i don't work anymore. I only thought I changed 'language : "en" to 'language : "no", or maybe "nb". Now it doesen't work anymore.

Is there a possibilty to have this to be done much more easily? Maybe ad a parameter in the language file? Do you understand?

function displaySimpleTinyMCEJS()
{
$js = '<script type="text/javascript">' . "\n";
$js .= 'tinyMCE.init({'. "\n"
.'mode : "textareas",'. "\n"
.'theme : "advanced",'. "\n"
.'language : "en",'. "\n"
.'plugins : "emotions",'. "\n"
.'editor_selector : "mceEditor",'. "\n"
.'theme_advanced_buttons1 : "bold, italic, underline, separator, strikethrough, justifyleft, justifycenter, justifyright, justifyfull, bullist, numlist, undo, redo, link, unlink, separator, emotions",'. "\n"
.'theme_advanced_buttons2 : "",'. "\n"
.'theme_advanced_buttons3 : "",'. "\n"
.'theme_advanced_toolbar_location : "top",'. "\n"
.'theme_advanced_toolbar_align : "left",'. "\n"
.'theme_advanced_path_location : "bottom",'. "\n"
.'extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|wid th|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|s ize|color|style],span[class|align|style]"
});' . "\n";
$js .= '</script>';
return $js;

}
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

yes, just add parame

Post by Jan »

yes, just add parameter:

language: "no" or "nb". But you must have a norwegian language file which must be saved somewhere (I think - I don't have any experience with this):

administrator/language/en-GB/en-GB.plg_editors_tinymce.ini ???

or here (with norwegian tinymce language file):
plugins/editors/tinymce/jscripts/tiny_mce/langs/en.js (en.js --> no.js or nb.js)

I think, the second is right, because Phoca Guestbook takes the TinyMCE libraries from:
plugins/editors/tinymce/jscripts/tiny_mce/ folder.

Jan
If you find Phoca extensions useful, please support the project
webansvarlig
Phoca Enthusiast
Phoca Enthusiast
Posts: 53
Joined: 01 Feb 2008, 03:09

Hehe. Stupid me. Fou

Post by webansvarlig »

Hehe. Stupid me. Found out the trouble before I've checked your answer. hehe. I had deleted the norwegian language files in tinymce, when uploading to joomla 1.5.1.

You have to just install tinyMCE language files. That is in three different folders. Theme, langs, plugins under the plugins/editors/tinymce/jscripts/tiny_mce/ folder.

Then you need to change the to letters under language in the com_phocaguestbook/helpers/phocaguestbook.php file.

It's the to first letters in the language:
English: en-GB ---> en
Norwegian: nb-NO ---> nb

Hope this will help others with the same problem.

Excuse me for bad english ;)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48739
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Post by Jan »

Great thank you
If you find Phoca extensions useful, please support the project
iherbak
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 24 Apr 2012, 12:59

Re: Change the language in the Tiny MCE editor

Post by iherbak »

I've changed the code in the helper (joomla 2.5) to rely on the global language object

function displaySimpleTinyMCEJS($displayPath = 0) {


$language = JFactory::getLanguage();
$langPrefix = substr($language->getTag(), 0, strpos($language->getTag(), '-'));


$js = '<script type="text/javascript">' . "\n";
$js .= 'tinyMCE.init({'. "\n"
.'mode : "textareas",'. "\n"
.'theme : "advanced",'. "\n"
.'language : "'.$langPrefix.'",'. "\n"
Post Reply