Skip to Content
Menu
This question has been flagged
1 Reply
5217 Views

I am creating a website for Malayalam news.

I am loading the google js file in my module as my_filename.js

but i have an error google is undefined..so i add a if loop,


var t = null;

function LoadGoogle()

{

if(typeof google != 'undefined' && google && google.load)

{

clearTimeout(t);

google.load("elements", "1", {

packages: "transliteration"

});

function onLoad() {

var options = {

sourceLanguage: 'en',

destinationLanguage: ['ml'],

shortcutKey: 'ctrl+g',

transliterationEnabled: true

};

// Create an instance on TransliterationControl with the required

// options.

var control =

new google.elements.transliteration.TransliterationControl(options);

// Enable transliteration in the textfields with the given ids.

var ids = [ "transl2" ];

control.makeTransliteratable(ids);

// Show the transliteration control which can be used to toggle between

// English and Hindi and also choose other destination language.

control.showControl('translControl');

google.setOnLoadCallback(onLoad);

alert('loaded');

}

}

else

{

alert('in else');

// Retry later...

if(t) {

clearTimeout(t);

}

t = setTimeout(LoadGoogle, 10);

}

}

LoadGoogle();


And my .xml is


<?xml version="1.0" encoding="utf-8" ?>

<openerp>

<data>

<template id="assets_backend" name="news_portal assets" inherit_id="web.assets_backend">

<xpath expr="link[last()]" position="after">

 <script type="text/javascript" src="http://www.google.com/jsapi"></script>

 <script type="text/javascript" src="/module_name/static/src/js/my_filename.js"></script>

<script type="text/css" src="/news_portal/static/src/css/news_portal.css"></script>

</xpath>

</template>

</data>

</openerp>

My objective is :

when i type a word in Manglish & leave a space i want that word in Malayalam.


Can any one help me?





Avatar
Discard
Best Answer

HI,

If the js is for an Odoo website page you have to push js on the "website.assets_frontent".

Avatar
Discard