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>

10 Responses to “Translating to other languages”

  1. Petr Petyovsky says:

    Hi

    I prepare Czech localization of your plugin.
    Please contact me back and I send you files in attachment.

    Regards,
    Petr.

  2. Frito says:

    Hi!

    First of all, thank you very much for your work. This works great with Tdo miniforms. Simple and clear.

    Just want to add a note to the transtation process.

    Alfter follow your steps, I notice that to get this work in other languages, you have to change in the first line on both file: ( eg: spanish: es.js and es_dlg.js)

    tinyMCE.addI18n(‘es.jbimages’,{
    desc : ‘Subir una imagen’
    });

    Is in your plans make something similar to embed video? Youtube, Vimeo..

    Thanks

    Frito

  3. our site says:

    Helpful info. Fortunate me I found your site by chance, and I am shocked why this twist of fate didn’t took place earlier! I bookmarked it.

  4. akilan says:

    is it possible to integrate with tinymce 4x version?

  5. Ronin says:

    Hello there!

    Thanks a lot for your great plugin!
    I implemented it on my test website and it looks perfect!

    But, russian users ask for Russian translation. If found it on the plugin folder, but don’t know how to activate it.

    Using TinyMCE 4.

    Thank you in advance, mate!

Leave a Reply