If you will go to above link it was mentioned that language code can be multiple and it is not 100% accurate, so that why I am prefering to keep in our own database because we needs only limited culture and that should be 100% as per our expectation not
surprise :)
Please let me know if you need more help.
Please give us feedback no matter whether you get your answer.
Please "Mark as Answer" if it's useful for you.
If u developing very complex application and u not have such time than u use online webservices that providing
Language code of any country code.
Here u will get standard language code if country using multiple languages.
Thanks
do you familiar with such a web service out there? I don't have a time to make my own database because I am using for about 60 languages, and for them there is hundreds of culture....
although, you cannot create CultureInfo object with that database. CultureInfoe.GetCulture will accept code such of "en" and not such as presented in database.
about the accept-language you have suggested. this is according to a browser settings. that means that when a user login from INDIA and it's OS using HEBREW it will still displays HEBREW and not INDIA nativae language (which I don't know what it is:) ).
I am looking for a way to convert IP location into language codes that will be accepted by cultureInfo object.
here is my code:
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
{
if (!string.IsNullOrEmpty(ci.ToString()))
{
DataRow dr = data.NewRow();
dr["ControlID"] = ci.IetfLanguageTag;
dr["ControlName"] = ci.NativeName;
dr["ImageName"] = ci.IetfLanguageTag + ".png";
data.Rows.Add(dr);
}
}
I selected here only languages. from IetfLanguageTag I have to conver it to the correct language codes as they displayed on
IetfLanguageTag variable.
So may be u can try to set language according User's Browser language.
But If u want to get lan. code from Ip Address.Than i can suggest some sites.
Also i found some Web service that convert Ip 2 LOcation and so by use of it u can convert it in a lan. code.
I dont no these service are free or not. But Check it out your self.
http://www.fraudlabs.com/ip2location.aspx
http://www.ip2location.com/webservices.aspx
http://ws.ip2location.com/ip2locationwebservice.asmx?op=IP2Location
Google Search:
ip2location web service
megetron
Member
520 Points
921 Posts
How to get the main cultur's language from Country Code?
Apr 07, 2010 06:16 AM|LINK
Hello,
I am using a web service which return country code by the IP.
Now I need to retrieve the language code so I can create a CultureInfo.
How do I do that?
Tapan Bhatt
Contributor
2352 Points
403 Posts
Re: How to get the main cultur's language from Country Code?
Apr 07, 2010 06:33 AM|LINK
Hi,
You need to set CultureInfo in global.asax.
Please go through below link:
http://www.c-sharpcorner.com/UploadFile/pradeepkv/MultilingualAppsInNet11282005010748AM/MultilingualAppsInNet.aspx
I hope it will helpful to you.
Regards,
Tapan
"Simple things should be simple, complex things should be possible."
Das.Sandeep
Star
10652 Points
1897 Posts
Re: How to get the main cultur's language from Country Code?
Apr 07, 2010 06:35 AM|LINK
You have to store in DB with country and language, because on country can have multiple language.
Please give us feedback no matter whether you get your answer.
Please "Mark as Answer" if it's useful for you.
Regards,
Sandeep
Tapan Bhatt
Contributor
2352 Points
403 Posts
Re: How to get the main cultur's language from Country Code?
Apr 07, 2010 06:42 AM|LINK
Hi,
Please go through below link:
http://madskristensen.net/post/Get-language-and-country-from-a-browser-in-ASPNET.aspx
"Simple things should be simple, complex things should be possible."
Das.Sandeep
Star
10652 Points
1897 Posts
Re: How to get the main cultur's language from Country Code?
Apr 07, 2010 07:04 AM|LINK
If you will go to above link it was mentioned that language code can be multiple and it is not 100% accurate, so that why I am prefering to keep in our own database because we needs only limited culture and that should be 100% as per our expectation not surprise :)
Please give us feedback no matter whether you get your answer.
Please "Mark as Answer" if it's useful for you.
Regards,
Sandeep
Chintan Dave
Contributor
3687 Points
742 Posts
Re: How to get the main cultur's language from Country Code?
Apr 07, 2010 07:15 AM|LINK
right u have to store country code in DB.
If u developing very complex application and u not have such time than u use online webservices that providing
Language code of any country code.
Here u will get standard language code if country using multiple languages.
Thanks
http://napsterchintan.blogspot.com/
megetron
Member
520 Points
921 Posts
Re: How to get the main cultur's language from Country Code?
Apr 07, 2010 11:07 AM|LINK
do you familiar with such a web service out there? I don't have a time to make my own database because I am using for about 60 languages, and for them there is hundreds of culture....
Chintan Dave
Contributor
3687 Points
742 Posts
Re: How to get the main cultur's language from Country Code?
Apr 07, 2010 12:05 PM|LINK
Hi havent use this type of web service. It should be availbe in Net.
by the way i can get data from this site and also can download.
http://www.mcanerin.com/EN/articles/meta-language.asp
From this link u can download codes:
http://www.ethnologue.com/codes
Thanks,
http://napsterchintan.blogspot.com/
megetron
Member
520 Points
921 Posts
Re: How to get the main cultur's language from Country Code?
Apr 08, 2010 01:23 AM|LINK
Thank you for your links.
although, you cannot create CultureInfo object with that database. CultureInfoe.GetCulture will accept code such of "en" and not such as presented in database.
about the accept-language you have suggested. this is according to a browser settings. that means that when a user login from INDIA and it's OS using HEBREW it will still displays HEBREW and not INDIA nativae language (which I don't know what it is:) ).
I am looking for a way to convert IP location into language codes that will be accepted by cultureInfo object.
here is my code:
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures)) { if (!string.IsNullOrEmpty(ci.ToString())) { DataRow dr = data.NewRow(); dr["ControlID"] = ci.IetfLanguageTag; dr["ControlName"] = ci.NativeName; dr["ImageName"] = ci.IetfLanguageTag + ".png"; data.Rows.Add(dr); }}I selected here only languages. from IetfLanguageTag I have to conver it to the correct language codes as they displayed on IetfLanguageTag variable.
What do you think? maybe a redesign is needed?
Chintan Dave
Contributor
3687 Points
742 Posts
Re: How to get the main cultur's language from Country Code?
Apr 08, 2010 06:31 AM|LINK
Ohh.
So may be u can try to set language according User's Browser language.
But If u want to get lan. code from Ip Address.Than i can suggest some sites.
Also i found some Web service that convert Ip 2 LOcation and so by use of it u can convert it in a lan. code.
I dont no these service are free or not. But Check it out your self.
http://www.fraudlabs.com/ip2location.aspx
http://www.ip2location.com/webservices.aspx
http://ws.ip2location.com/ip2locationwebservice.asmx?op=IP2Location
Google Search:
ip2location web service
alo check out this sites for more knowledge:
http://www.ipaddresslocation.org/
http://www.1keydata.com/blog/2006/09/convert-ip-address-to-country.html
http://www.filebuzz.com/files/Convert_Ip_Address_To_Geographic_Location/freeware-1.html
http://www.byteblocks.com/post/2009/06/01/Convert-IP-To-Location-and-Address-To-Location.aspx
http://ip-to-country.webhosting.info/book/print/5
http://www.ip2location.com/free.asp
Reverse DNS Lookup
http://www.ipaddresslocation.org/dns-ipaddress-lookup.php
Thanks
Chintan Dave.
http://napsterchintan.blogspot.com/