Child pages
  • Use Google Translation API to translate In-Portal language packs
Skip to end of metadata
Go to start of metadata

Imported from:

I have came across the idea that we can start with using Google API to translate current Language packs and even integrate Google JS translator into out Phrases part of where ever it make sense to use the best.

Everyone on the list please share your opinion on this.

Related Tasks

INP-807 - Getting issue details... STATUS


  1. Here is link to php class, that will do that:

  2. Hi,

    as per my experience in using google translation everyday in many different
    languages, it works well for single word and short sentences, and works very
    badly for complete sentence.
    This is not really a problem in our case, as long sentences always need a
    custom translation according to customer marketing needs, while single words
    no need special adjustments, then it could be nice to have it, if we can
    override translation for given labels.


    2010/4/22 Dmitry A. <>

  3. I propose we add virtual field named "Translate Using Google" checkbox, that
    will translate all labels from primary language to given language once it is
    saved. Visible only when language is created.

  4. Yes, I am all for it!

    Can we do this ASAP in 5.1.x so we can provide Language packs for everyone.

    We still need some sort of tools on site for proper Language
    pack management.


  5. That tools won't be available soon based on human resources available.

  6. it's a cool feature, but we don't modify it everyday, and it works not so
    bad actually ;-)

    if you need to translate a whole pack, it's easy to do using google
    translation online, it takes few minutes... and may take hours implementing
    it... would you like me to do a "google-translated" lang packs?

    2010/4/23 Alexander Obuhovich <>

  7. I heard, that Dmitry was already implementing my idea. I hope patch will be
    available soon.

  8. cool ^-^

    2010/4/25 Alexander Obuhovich <>

  9. Ping on this. Still no patch?

  10. Sorry for a delay with this.

    I'll be working on 5.1.0 branch to provide a patch for this shortly.


  11. So, where is the patch again? You say sorry for the delay and delay again.

  12. I really need that script, since I need to create Russian language pack. Can
    write it myself, but since you've already started it, then please share.

  13. So no patch, no task, no nothing. That's really bad, since Dmitry told me
    few months ago, that he really got a working patch already. It's really
    taking that long to attach it here and create appropriate task?

  14. I'm not hoping for any response here, but patch will be appreciated.

  15. Hi everyone and Alex ;)

    Sorry for a long delay here, other things kept me busy. Finally, I have
    found some time to code promised integration with Google Translate API.

    Good thing that I have learned is that Google released a new new version of
    their API (even though it's in labs yet). Here is link if someone want's to
    check it out<>

    What I am trying to figure out is how to make this whole thing even more
    useful. To make things easier let's recap what need's to be done:

    1. Ability to translate the while Language Pack at the time of creation and
    copying from another language.

    2. Ability to translate right from the Add/Edit Phrase interface in Admin? I
    suppose we need to have here Source and Target languages somewhere - not
    sure where for now.

    Please let me know if you have more ideas here. Let's finalize this and I'll
    get it quick I promise this time!


  16. Why we need to integrate google translate into phrase add/edit form if there
    are already a website that does translation.

    If you need to translate, then I see no problems in going to website that
    does that for us.

    Another thing is when you need to mass-translate. This is where this could
    be useful.

  17. 1. usefull

    2. same opinion as Alex, it'd take time for little result, as when we edit a
    phrase, we want to manually change the translation, and not translate it
    automatically once again ;)

    2011/1/7 Alexander Obuhovich <>

  18. Hi guys,

    Here is a working prototype (as a patch).

    Will be doing some improvements to speed up the translation process.



  19. Thanks for long waited patch. Here are few notes from me:

       - What is: AIzaSyDzfNLxl91mDRW1OPIKJfN-oETIHuzvMEY key. Is it
       domain-based (or how user can change it) and maybe we can do it all without
       - Why you set USER_AGENT for curl request with strange "FeedBurner feed"
       comment near it? maybe it will work without it too?
       - How long does script execute (I mean that curl request), assuming you
       have 3000 phrases in language pack?

    Maybe it's better to move *$this->Application->getUnitOption('phrases',
    'TableName') *code before update cycle starts.

  20. Hi Alex,

    Thanks for your code review. The answer is yes - there is a room for
    optimization which I was going to do in any case.


    1. Yes, it's a API key that needs to be present in order for Translation API
    to work. Currently I have hard-coded mine since need to figure out the
    difference between API Key used for Google Maps (configuration belongs to
    In-Link module) and the one I need here. I believe these are 2 different
    keys, but I'll check and merge it if needed.

    2. Yes, comment will go away the same as the whole Agent part. Still need to
    run few more tests.

    3. Translation Speed - yes it worked for me, but took quite a bit which is
    not acceptable for Production version. I am planning on changing the code to
    make fewer Curl requests by translating 10 or 20 labels at a time. By the
    way, how much data would be 5K? I have read that POST method for translation
    will support up to 5K, but haven't clearly converted it to any legitimate
    number to understand how much I can fit in a single request.

    4. Yes, table will be moved out of the loop.



  21. Ok, try to use "batch" functionality (google has it in data api, but I don't
    know about translation api).

    You can collect phrases to be translated into a string and when it's length
    will be just before 5KB you can send them all together.

  22. Yes, that I was planning to do.

    I can pass multiple "q=SourceText" in a single request ( ).
    The question is how do I know that my total request Size is close to 5KB
    before I send it?

    I can do math using *strlen* of the PostData property of Curl object to get
    size in bytes and convert to KB?


  23. You can serialize phrases array and measure it.

  24. Here is a new improved version of the translator.

    1. It sends 70 phrases per single request

    2. It uses 1 SQL to update all 70 translations at once (too bad I have
    reached API limited to fully test this.

    Last results are about 50-60 seconds to translate 3,700 phrases (~53 API
    requests). The results might vary depending on your host.

    I think that If i can get 2. to work - it will be even faster!