This project is read-only.

Standardise the urls using the IetfLanguageTag

Sep 15, 2009 at 3:16 PM
If looks like you can call each of the regional Bing home pages using the Ietf tag i.e. http://www.bing.com/?mkt=en-GB or http://www.bing.com/?mkt=en-US
This makes it easier to add new regions (e.g. Australian) when you want. This could be driven by user settings.
        static BingHelper()
        {
            List<CultureInfo> bingCultures = new List<CultureInfo>();

            bingCultures.Add(CultureInfo.GetCultureInfoByIetfLanguageTag("en-US"));
            bingCultures.Add(CultureInfo.GetCultureInfoByIetfLanguageTag("en-SG"));
            bingCultures.Add(CultureInfo.GetCultureInfoByIetfLanguageTag("ja-JP"));
            bingCultures.Add(CultureInfo.GetCultureInfoByIetfLanguageTag("en-GB"));
            bingCultures.Add(CultureInfo.GetCultureInfoByIetfLanguageTag("en-CA"));
            bingCultures.Add(CultureInfo.GetCultureInfoByIetfLanguageTag("zh-CN"));
            bingCultures.Add(CultureInfo.GetCultureInfoByIetfLanguageTag("de-DE"));
            bingCultures.Add(CultureInfo.GetCultureInfoByIetfLanguageTag("en-AU"));

            foreach (CultureInfo bingCulture in bingCultures)
            {
                bingObjects.Add(new BingObject(bingCulture.DisplayName, String.Format("http://www.bing.com/?mkt={0}",bingCulture.IetfLanguageTag)));
            }
        }

 I also changed what is returned by the CountryCode so it returns the whole code rather than just the last 2 characters. So if you were to obtain both the es-US and en-US images it would not overwrite the images.

 public string CountryCode
        {
            get
            {
                return this._downloadURL.Substring(_downloadURL.IndexOf("=") + 1);
            }
        }

Can you please update the source code to match the latest download?

Cheers :)

Sep 15, 2009 at 3:31 PM

Noticed IetfLanguageTag is deprecated use Name instead.

Coordinator
Sep 15, 2009 at 4:21 PM

Hi,

Thanks for your contributions.

Check out the code from here

http://bing.codeplex.com/SourceControl/changeset/view/26508#

Ignore the contents of the . directory and open the BD3.0 folder.

 

And do the changes and check it in back.

I've given "Developer" rights to you. So you should be able to check in the code.

:D

 

I'll probably work on bringing the hottext back in the application and also planning to add a "auto update" feature.

 

Coordinator
Sep 16, 2009 at 9:16 AM

en-SG is not a valid culture. Moreover, the DisplayName property of a culture displays the language and then the country. The language I think is not important here...

Kept the old code as such...

Sep 16, 2009 at 9:50 AM
Edited Sep 16, 2009 at 11:12 AM

en-SG is being used by MS for English (Singapore),  and works fine on my box.

 

I thought about the DisplayName last night and agree with that the language isn’t important, so have just stripped out the country.

 

Regards

 

Si

 

Coordinator
Sep 16, 2009 at 10:00 AM

Aww..

Even in my regional and language settings, I don't see that option... and I live in Singapore!!!

languages

 

Which OS are you using. I'm still on XP :-( Could that be the reason...?

BTW, I've updated to 3.0.2

Sep 16, 2009 at 10:04 AM
Edited Sep 16, 2009 at 11:14 AM

I am running Win7 J 

 

 

 

Coordinator
Sep 16, 2009 at 10:10 AM

This is the latest source code.

http://bing.codeplex.com/SourceControl/changeset/view/26871

The BD 3.0.2 folder contains the latest changes including the change I made for displaying the hot text and url's

If at all you are making changes, change it here and add it to the set.

:D

 

PS:

I think they have added support for en-SG in Win 7 or Vista. On my PC it crashes... and so will it be on a whole lot of XP PCs... :(

Either we got to find a way to download Bing International website image or leave the code as such...

Sep 16, 2009 at 10:12 AM
Edited Sep 16, 2009 at 11:12 AM

OK I will have a think about it

 

Si

 

From: mugunthkumar [mailto:notifications@codeplex.com]
Sent: 16 September 2009 10:11
To: Simon Phillips
Subject: Re: Standardise the urls using the IetfLanguageTag [bing:68985]

 

From: mugunthkumar

This is the latest source code.

http://bing.codeplex.com/SourceControl/changeset/view/26871

The BD 3.0.2 folder contains the latest changes including the change I made for displaying the hot text and url's

If at all you are making changes, change it here and add it to the set.

:D

 

PS:

I think they have added support for en-SG in Win 7 or Vista. On my PC it crashes... and so will it be on a whole lot of XP PCs... :(

Either we got to find a way to download Bing International website image or leave the code as such...