Translate Text with Google API

I've seen companies translate their application for example from Dutch to French or English etc.

and even though machine translation isn't perfect it might help speed things along.

I've added a Google API library with Google Translate to the Standard Libraries project.

http://www.oehive.org/project/lib

Here's how it works -


/**
 * test-slibgoogle.p -
 *
 * (c) Copyright ABC Alon Blich Consulting Tech, Ltd.
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. If not, see .
 *
 *  Contact information
 *  Email: alonblich@gmail.com
 *  Phone: +972-54-218-8086
 */

{slib/slibgoogle.i}

define var str as char no-undo.



/*
Language                Language code
--------                -------------
Afrikaans               af
Albanian                sq
Arabic 	                ar
Belarusian              be
Bulgarian               bg
Catalan                 ca
Chinese Simplified      zh-CN
Chinese Traditional     zh-TW
Croatian                hr
Czech                   cs
Danish                  da
Dutch                   nl
English                 en
Estonian                et
Filipino                tl
Finnish                 fi
French                  fr
Galician                gl
German                  de
Greek                   el
Haitian Creole          ht
Hebrew                  iw
Hindi                   hi
Hungarian               hu
Icelandic               is
Indonesian              id
Irish                   ga
Italian                 it
Japanese                ja
Latvian                 lv
Lithuanian              lt
Macedonian              mk
Malay                   ms
Maltese                 mt
Norwegian               no
Persian                 fa
Polish                  pl
Portuguese              pt
Romanian                ro
Russian                 ru
Serbian                 sr
Slovak                  sk
Slovenian               sl
Spanish                 es
Swahili                 sw
Swedish                 sv
Thai                    th
Turkish                 tr
Ukrainian               uk
Vietnamese              vi
Welsh                   cy
Yiddish                 yi
*/

run google_translate(
    input   "en",
    input   "Customer Name",
    input   "de",
    output  str ).

message str view-as alert-box.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alonb's picture

Note that you may need to

Note that you may need to install an SSL certificate first to use the Google API.

The certificate file is in slib/bin/equifax_secure_certificate_authority.cer.

To install the certificate -

1. Run proenv

2. In the command line type: certutil -import "[the certificate file full path]"

Note: I've had problems using certutil and a certificate file path with spaces.