Is there any package for hindi language?


#1

i want to apply one single textarea with hindi language typing. is there any package for it …??
i tried google translate api but it pokes meteor js and application goes haywire.

if there is any package please suggest example to use it.

thank you…


#2

i tried this link as help and app goes haywire.

https://developers.google.com/transliterate/v1/getting_started#browserCompatibility

i tried this

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

to head section in main html template.

and on template.js
template.templateName.onRendered(function() {
google.load(“elements”, “1”, {
packages: “transliteration”
});

......

})

this code. i debug the code and found out after executing google.load() method whole application turns into blank page.


#3

Try this (notice the callback parameter in the load function):

Template.body.onRendered(function onRendered() {
  google.load('elements', '1', {
    packages: 'transliteration',
    callback: onLoad
  });

  function onLoad() {
    var options = {
      sourceLanguage:
        google.elements.transliteration.LanguageCode.ENGLISH,
      destinationLanguage:
        [google.elements.transliteration.LanguageCode.HINDI],
      shortcutKey: 'ctrl+g',
      transliterationEnabled: true
    };
    var control = 
      new google.elements.transliteration.TransliterationControl(options);
    control.makeTransliteratable(['transliterateTextarea']);
  }
});

#4

Here’s the Meteor Guide article on internationalization: http://guide.meteor.com/ui-ux.html#i18n


#5

is it ok if I write the code in Template.myTemplate.onRendered(function onRendered() {}); function.

because you gave me code for Template.body.onRendered(function onRendered() {}); in comment.

and another one thing. when i run the project and redirect to page on which onRendered i call the google.load() function it gives error like this.

TypeError: Cannot read property ‘transliteration’ of undefined
at onLoad (textArea.js:11)
at . (textArea.js:4)
at template.js:119
at Function.Template._withTemplateInstanceFunc (template.js:465)
at fireCallbacks (template.js:115)
at . (template.js:208)
at view.js:107
at Object.Blaze._withCurrentView (view.js:538)
at view.js:106
at Object.Tracker._runFlush (tracker.js:497)

the error is on line
sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,

thank you…


#6

thank you. but i dont think that help me for my project.
because as far as i know in that i have to decide which part should show what in another language.

and in my project i have to insert every time new document in hindi language in database… i.e. every time input is different …


#7

thank you bro… you rocks… i use your suggestion but in different way.

i.e. i wrote the onLoad() function directly to callback function.

because of i wrote it below the google.load() function and the callback delays to execute it was giving error of Cannot read property ‘transliteration’ of undefined.

so i wrote that function directly to callback as

google.load("elements", "1", {
packages: "transliteration",
callback : function () {
var options = {
sourceLanguage: 'en',
destinationLanguage: ['hi'],
shortcutKey: 'ctrl+g',
transliterationEnabled: true
};
var control = new google.elements.transliteration.TransliterationControl(options);
control.makeTransliteratable(['abc']);
}
});

so it worked perfectly…

thanks a lot…