Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
C#
public void  wetter()
        {
            try
            {
                string ort; // ort = Location
                ort = txtOrt.Text;
                XmlDocument googlewetter = new XmlDocument();
                googlewetter.Load(string.Format("http://www.google.com/ig/api?weather={0}", ort));
                
string stadt = googlewetter.SelectSingleNode("/xml_api_reply/weather/forecast_information/city").Attributes[0].InnerText;
                lbStadt.Text = stadt;
                
string temperatur = googlewetter.SelectSingleNode("/xml_api_reply/weather/current_conditions/temp_c").Attributes[0].InnerText;
                lbTemperatur.Text = temperatur;
                
string aktuell = googlewetter.SelectSingleNode("/xml_api_reply/weather/current_conditions/condition").Attributes[0].InnerText;
                lbAktuell.Text = aktuell;
                
string wind = googlewetter.SelectSingleNode("/xml_api_reply/weather/current_conditions/wind_condition").Attributes[0].InnerText;
                lbWind.Text = wind;
                
string luft = googlewetter.SelectSingleNode("/xml_api_reply/weather/current_conditions/humidity").Attributes[0].InnerText;
                lbLuft.Text = luft;
            }
            catch
            {
                MessageBox.Show("Error");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            wetter();
        }


Why is the output language always English? I want German.
Posted
Updated 21-Sep-10 21:25pm
v4
Comments
HimanshuJoshi 21-Sep-10 12:33pm    
Removed bold style from the question text

You can change the language for the request using the &hl= parameter. For example http://www.google.com/ig/api?weather=london,england&hl=de will return all text in German
 
Share this answer
 
v2
No the problem is.. When i start debugging.. The windows form shows me the whole weather dates in english. The dates in the browser(Firefox) are in german
 
Share this answer
 
v2
I just tried http://www.google.com/ig/api?weather=berlin,germany&hl=de&us=de[^] and received the following reply:
XML
<xml_api_reply version="1">
<weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0" >
<forecast_information>
<city data="Berlin, Berlin"/>
<postal_code data="berlin,germany"/>
<latitude_e6 data=""/>
<longitude_e6 data=""/>
<forecast_date data="2010-09-22"/>
<current_date_time data="2010-09-22 11:50:00 +0000"/>
<unit_system data="SI"/>
</forecast_information>
<current_conditions>
<condition data="Teils bewölkt"/>
<temp_f data="66"/>
<temp_c data="19"/>
<humidity data="Feuchtigkeit: 56 %"/>
<icon data="/ig/images/weather/partly_cloudy.gif"/>
<wind_condition data="Wind: SO mit 8 km/h"/>
</current_conditions>
<forecast_conditions>
<day_of_week data="Mi."/>
<low data="10"/>
<high data="19"/>
<icon data="/ig/images/weather/mostly_sunny.gif"/>
<condition data="Meist sonnig"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="Do."/>
<low data="12"/>
<high data="21"/>
<icon data="/ig/images/weather/sunny.gif"/>
<condition data="Klar"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="Fr."/>
<low data="13"/>
<high data="22"/>
<icon data="/ig/images/weather/chance_of_rain.gif"/>
<condition data="Vereinzelt Regen"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="Sa."/>
<low data="10"/>
<high data="16"/>
<icon data="/ig/images/weather/chance_of_rain.gif"/>
<condition data="Vereinzelt Regen"/>
</forecast_conditions>
</weather>
</xml_api_reply>


Which is the part that you think is wrong?
 
Share this answer
 
Please help me

i need this
 
Share this answer
 
Is there noone who can help me with this problem :(( ?
 
Share this answer
 
No there is nothing wrong but the visual studio output is always in english.. I put in the german wheater but i get the english weather, why?
 
Share this answer
 
Comments
Richard MacCutchan 23-Sep-10 15:10pm    
If you actually read my answer above, you will see quite clearly that the answers are in German. What more information do you need?
note work please help me bbargouthi@yahoo.com
 
Share this answer
 
Comments
[no name] 12-Sep-12 11:20am    
How is posting this incomplete sentence an answer to this 2 year old question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900