Translate on 
Glass 
Trish Whetzel
Outline 
● Project Workflow 
● Google Translate API 
● Glassware 
● Build App
Project Workflow 
● Launch app 
● Speak word of phrase to translate 
● A card is returned with the translation
Google Translate API* 
● API or Application programming interface 
○ Set of routines, protocols, tools, or remote calls for 
building software applications. 
○ Google Translate API lets websites and programs 
integrate with Google Translate programmatically 
● REST Web service 
https://developers.google.com/translate/ 
*paid service
REST Web services 
● Accessed via HTTP 
● Each unique URL is a representation of 
some object 
● Operations include PUT, GET, POST, 
DELETE
Translate API operations 
Operation Description REST HTTP mapping 
translate Translates source text from source 
language to target language 
GET 
languages List the source and target languages 
supported by the translate methods 
GET 
detect Detect language of source text GET
Translate Text 
GET https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY& 
source=en&target=de&q=Hello%20world 
Required Parameters: 
API Key {key} - register on Google Console for an API Key 
Source text string {q} - text to translate 
Target language {target} - language you want to translate into 
https://developers.google.com/translate/v2/using_rest#Translate
Response 
200 OK 
{ 
"data": { 
"translations": [ 
{ 
"translatedText": "hola mundo" 
} 
] 
} 
}
Glassware 
● Glass Development Kit (GDK) 
○ Add-on to the Android SDK 
○ Runs directly on Glass 
● Mirror API 
○ Web-based services that interact with Google Glass 
○ Functionality provided over a cloud-based API and 
does not require running code on Glass 
https://developers.google.com/glass/
Other Helpful Resources 
● Coding questions 
○ Stack Overflow http://stackoverflow.com/ 
○ G+ Glass Developers group https://plus.google. 
com/u/0/communities/105104639432156353586 
● Google Glass Sample Code 
○ https://github.com/googleglass 
● Report Bugs 
○ https://code.google.com/p/google-glass-api/
Let’s Get Started! 
● We’ll extend the ApiDemo sample project 
developed by the Google Glass team 
○ https://github.com/googleglass/gdk-apidemo-sample 
● Google Developer documentation for Glass 
○ https://developers.google.com/glass
Future Work 
● Add methods to translate TO and FROM any 
language supported by the Google Translate 
API 
● Format Layout to display speech input and 
translated text and image to represent the 
country of each
Building Translate on Glass
Building Translate on Glass

Building Translate on Glass

  • 1.
    Translate on Glass Trish Whetzel
  • 2.
    Outline ● ProjectWorkflow ● Google Translate API ● Glassware ● Build App
  • 3.
    Project Workflow ●Launch app ● Speak word of phrase to translate ● A card is returned with the translation
  • 8.
    Google Translate API* ● API or Application programming interface ○ Set of routines, protocols, tools, or remote calls for building software applications. ○ Google Translate API lets websites and programs integrate with Google Translate programmatically ● REST Web service https://developers.google.com/translate/ *paid service
  • 9.
    REST Web services ● Accessed via HTTP ● Each unique URL is a representation of some object ● Operations include PUT, GET, POST, DELETE
  • 10.
    Translate API operations Operation Description REST HTTP mapping translate Translates source text from source language to target language GET languages List the source and target languages supported by the translate methods GET detect Detect language of source text GET
  • 11.
    Translate Text GEThttps://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY& source=en&target=de&q=Hello%20world Required Parameters: API Key {key} - register on Google Console for an API Key Source text string {q} - text to translate Target language {target} - language you want to translate into https://developers.google.com/translate/v2/using_rest#Translate
  • 12.
    Response 200 OK { "data": { "translations": [ { "translatedText": "hola mundo" } ] } }
  • 13.
    Glassware ● GlassDevelopment Kit (GDK) ○ Add-on to the Android SDK ○ Runs directly on Glass ● Mirror API ○ Web-based services that interact with Google Glass ○ Functionality provided over a cloud-based API and does not require running code on Glass https://developers.google.com/glass/
  • 14.
    Other Helpful Resources ● Coding questions ○ Stack Overflow http://stackoverflow.com/ ○ G+ Glass Developers group https://plus.google. com/u/0/communities/105104639432156353586 ● Google Glass Sample Code ○ https://github.com/googleglass ● Report Bugs ○ https://code.google.com/p/google-glass-api/
  • 15.
    Let’s Get Started! ● We’ll extend the ApiDemo sample project developed by the Google Glass team ○ https://github.com/googleglass/gdk-apidemo-sample ● Google Developer documentation for Glass ○ https://developers.google.com/glass
  • 16.
    Future Work ●Add methods to translate TO and FROM any language supported by the Google Translate API ● Format Layout to display speech input and translated text and image to represent the country of each