Using Google Transliterate API with YII


Using Google Transliterate API is straight forward. However to meet the goals of the small project (Webapp for food Catering company) I need to overcome following challenges.

Want to change id of text box (Tablename_fieldname) at will

Google text box id defaults to transliterateTextarea. I was not able to figure out how to change the YII $form object which enforces id of format Tablename_fieldname. I figured out its far more easier to change in the javascript of google to the id which YII requires.

 

change from

control.makeTransliteratable(['transliterateTextarea']);

to

var ids = ["Dish_dish", "Dish_dish2"]

control.makeTransliteratable(ids);

This brings us to the next challenge. I have to add one line for every field attribute I want to transliterate in the main site template page.

Load Google Transliterate API only in the views and not in every page

Advertisements

One Comment Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s