Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Avith Gutierrez
2,797 PointsHow can i translate the weahter API content from EN to SP ?
I look up for the response to use the Celsius Degrees in the app response
´´´ swift
let baseURL = NSURL(string:"https://api.forecast.io/forecast/\(apiKey)/")
let forecasrURL = NSURL(string:"19.429418,-99.205582?units=si", relativeToURL: baseURL)
´´´
Reading the API documentation it refers that we can use some other languages:
lang=[language]: Return text summaries in the desired language. (Please be advised that units in the summary will be set according to the units option, above, so be sure to set both options as needed.) [language] may be bs (Bosnian), de (German), en (English, which is the default), es (Spanish), fr (French), it (Italian), nl (Dutch), pl (Polish), pt (Portuguese), tet (Tetum), or x-pig-latin (Igpay Atinlay). (If a different language is desired, please consider contributing to our API translation module on Github.)
But where do i declare the other language that i need to display within the code?
Any help?
Thanks.
1 Answer
Amin Lalji
1,350 PointsYou can add the language parameter to the forecastURL as in:
let forecasrURL = NSURL(string:"19.429418,-99.205582?units=si&lang=es", relativeToURL: baseURL)
Hope this helps
Avith Gutierrez
2,797 PointsAvith Gutierrez
2,797 PointsWorked like a charm !! Thanks Amin :D