Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How can i load js ?

By
preethy
on 7/20/16, 2:58 AM 213 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?





Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/20/16, 2:58 AM
Seen: 213 times
Last updated: 7/20/16, 3:36 AM