Translate how-to

Translation of Justboil.me TinyMCE images pluign is quite simple.

For TinyMCE 3.x. This guide is valid for TinyMCE 3.x

Step 1. Translating PHP

  1. Download the custom-lang.zip and unpack it to jbimages/ci/application/language/. Change pack’s name to your language name or to whatever you want (e.g. esperanto or esperantolang). You will set this folder’s name in .js file (Step 2).
  2. Translate all language strings in the appropriate .php files.
    So, $lang['upload_userfile_not_set'] = "Unable to find a post variable called userfile."
    comes to $lang['upload_userfile_not_set'] = "Ne povas trovi postenon variablo nomita userfile".

The first file you need to translate is upload_lang.php, other language files are used rarely or prepared for upcoming features.

Step 2. Translating JavaScript

Now, when plugin’s PHP core is translated, you are ready to translate JavaScript strings.

  1. Open /jbimages/langs/ and copy en.js to {tinymce_lang_code}.js and en_dlg.js to {tinymce_lang_code}_dlg.js. TinyMCE language codes can be explored at http://www.tinymce.com/i18n/index.php?ctrl=lang&act=download&pr_id=1.
    So, if you are going to translate to esperanto, the correct file names will be eo.js and eo_dlg.js.
  2. Set the correct language code in the first line of both files {tinymce_lang_code}.js and {tinymce_lang_code}_dlg.js. In our example this will be: tinyMCE.addI18n('eo.jbimages_dlg',{
    (thanks to Frito)
  3. Combine your .js files with .php files. Open {tinymce_lang_code}_dlg.js and change the
    lang_id : 'english' to lang_id : '{PHP folder name from Step 1}'.
    So, if we have folder jbimages/ci/application/language/esperanto, we will set this to lang_id : 'esperanto'.
  4. Translate all other textual strings in both .js files.

Step 3. Make TinyMCE load with new language

Set the tinyMCE.init option language to your language code:

<!-- Powered with JustBoil Images (a TinyMCE Images Upload Plugin). More info at http://justboil.me/ -->
<script type="text/javascript">
tinyMCE.init({
	// Language parameter
	language : "eo",
	
	// JBIMAGES important options
	theme : "advanced",
	relative_urls : false,
	plugins : "jbimages",
	theme_advanced_buttons1 : "jbimages,|"
	
	// Other TinyMCE options ....
	// Use the full code example at http://justboil.me/
});
</script>