building translate on glass
DESCRIPTION
Slides from the Women Hacking Glass session. The slides describe how to use the Google Translate API within a Glass app.TRANSCRIPT
![Page 1: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/1.jpg)
Translate on GlassTrish Whetzel
![Page 2: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/2.jpg)
Outline● Project Workflow● Google Translate API● Glassware● Build App
![Page 3: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/3.jpg)
Project Workflow● Launch app● Speak word of phrase to translate● A card is returned with the translation
![Page 4: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/4.jpg)
![Page 5: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/5.jpg)
![Page 6: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/6.jpg)
![Page 7: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/7.jpg)
![Page 8: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/8.jpg)
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
![Page 9: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/9.jpg)
REST Web services● Accessed via HTTP● Each unique URL is a representation of
some object● Operations include PUT, GET, POST,
DELETE
![Page 10: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/10.jpg)
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
![Page 11: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/11.jpg)
Translate TextGET 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 KeySource text string {q} - text to translateTarget language {target} - language you want to translate into
https://developers.google.com/translate/v2/using_rest#Translate
![Page 12: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/12.jpg)
Response200 OK
{ "data": { "translations": [ { "translatedText": "hola mundo" } ] }}
![Page 13: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/13.jpg)
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 Glasshttps://developers.google.com/glass/
![Page 14: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/14.jpg)
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/
![Page 15: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/15.jpg)
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
![Page 16: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/16.jpg)
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
![Page 17: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/17.jpg)
![Page 18: Building Translate on Glass](https://reader033.vdocument.in/reader033/viewer/2022060118/558969c1d8b42a8e268b464a/html5/thumbnails/18.jpg)