Wednesday, July 27, 2011

Write in 9 Indian Scripts in Drupal 6 using TinyMCE and FCKEditor Plugin | Vishal Monpara's Blog

Write in 9 Indian Scripts in Drupal 6 using TinyMCE and FCKEditor Plugin | Vishal Monpara's Blog


Here is a procedure on how to enable Drupal 6 to write in Indian language Bengali / Gujarati / Hindi / Marathi / Sanskrit / Kannada / Malayalam / Oriya / Punjabi / Tamil and Telugu.
Prerequisite:
  1. Download Wysiwyg project and install it atWEBROOT\sites\all\modules\wysiwyg. Enable this module by navigating to Administer > Site Building > Modules.
  2. Download TinyMCE / FCKEditor and install it atWEBROOT\sites\all\libraries\tinymce(/fckeditor).
There are two ways to enable Drupal 6 to allow user to type in Indian scripts.
  1. Using TinyMCE
  2. Using FCKEditor
Both are equally capable with almost same functionality but it is just a matter of personal choice which one to use.
Using FCKEditor
  1. Download IndicIME plugin for FCKEditor and put it atWEBROOT\sites\all\libraries\fckeditor\editor\plugins so that “indicime” will become sub-folder of plugins
  2. Open the file WEBROOT\sites\all\modules\wysiwyg\editors\fckeditor.inc in text editor
  3. Copy/paste following code at the very bottom in the function wysiwyg_fckeditor_plugins.
    'indicime' => array(
          'path' => $editor['library path'] . '/editor/plugins',
          'buttons' => array(
            'indicime' => t('IndicIME'),
            'indicimehelp' => t('IndicIME Help'),
          ),
          'options' => array (
            'IndicIMEScripts' => t('My Bengali:bengali;My Gujarati:gujarati;My Devanagari:devanagari;English (F12):english'),
          ),
          'internal' => TRUE,
          'load' => TRUE,
        ),
  4. If you want all scripts to be shown, remove “options” line from the above code. “options” is given to show you easy customization of list.
  5. Now navigate to Administer > Site Configuration > Wysiwyg.
  6. For “Filtered HTML” and “Full HTML” input format, select “FCKEditor” and “Save”.
  7. After saving, you will be shown an option for “Edit” for each input format.
    fckinputformat
  8. Click on “Edit” and open section “Buttons and Plugins”. Select “IndicIME” and “IndicIME Help” button for both input format and “Save”.
    indicimebutton
  9. Now navigate to Create Content > Page, you will get Indic IME drop down box for choosing language and help button to show keyboard.fckindicime
  10. Enjoy typing in your own language.
Using TinyMCE
  1. Download IndicIME plugin for TinyMCE and put it atWEBROOT\sites\all\libraries\tinymce\jscripts\tiny_mce\plugins so that “indicime” will become sub-folder of plugins
  2. Open the file WEBROOT\sites\all\modules\wysiwyg\editors\tinymce.inc in text editor
  3. Copy/paste following code at the very bottom in the function wysiwyg_tinymce_plugins.
    'indicime' => array(
            'path' => $editor['library path'] .'/plugins/indicime',
            'buttons' => array(
              'indicime' => t('IndicIME'),
              'indicimehelp' => t('IndicIME Help')
            ),
            'options' => array (
              'indicime_scripts' => t('My Bengali:bengali;My Gujarati:gujarati;My Devanagari:devanagari;English (F12):english')
            ),
            'internal' => TRUE,
            'load' => TRUE,
             ),
  4. If you want all scripts to be shown, remove “options” line from the above code. “options” is given to show you easy customization of list.
  5. Now navigate to Administer > Site Configuration > Wysiwyg.
  6. For “Filtered HTML” and “Full HTML” input format, select “TinyMCE” and “Save”.
  7. After saving, you will be shown an option for “Edit” for each input format.
    IndicIME for TinyMCE with Drupal
  8. Click on “Edit” and open section “Buttons and Plugins”. Select “IndicIME” and “IndicIME Help” button for both input format and “Save”.
    indicimebutton
  9. Now navigate to Create Content > Page, you will get Indic IME drop down box for choosing language and help button to show keyboard.IndicIME for TinyMCE with Drupal
  10. Enjoy typing in your own language.