Correct Language header when language does not belong to the country - localization

Let's say I have a webpage in Spain. This could mean that the only locale I support is es-ES, so that'll be the only possible value for both Accept-Language and Content-Language headers. Now I want to make the page available also in English. As far as I know, en-ES does not exist but kind of represents my use case, I want English language with Spain as region. If I instead provide en-US for instance, then I'm missing the region information for my upstream service, it no longer knows I'm in Spain since the locale is referencing the United States. How could I solve this or provide the complete information to the upstream service, both the language and region even though they are not related (I want English language with Spain as region?

Related

Google Actions not supported for English(Ireland) language

I'm developing an Action on Google for the Irish market and I've noticed that my actions aren't available if the language in my account settings is set to English (Ireland), I get a message saying, "<> is not available for your country or language". Would anybody know how solve this issue (other than changing my language settings to English UK or US)? Ideally, I'd like to change some setting in my action so that it will be available no matter what the language selected is and restrict the access only by country.
You can localize your Actions for the Google Assistant to provide customized experiences for different languages and locales that users can set on their devices. Locale is the combination of a language and region, in your case, English (Ireland). Actions on Google can currently be localized to one of the following English locales: USA (en-US), UK (en-GB), Australia (en-AU), Canada (en-CA), and a few others. Ireland (en-IE) is not one of them, unfortunately.
References: https://developers.google.com/actions/localization/
https://developers.google.com/actions/localization/languages-locales

Is it possible to handle support for multiple variations of the same language with BlackBerry API 7.x?

I'm working with BlackBerry API 7.1 on Eclipse and I want to know if it's possible to add localization for variations of the same language.
I'm working on an app that needs to be localized for 10 countries that speak Spanish, but every country uses different manners of speech.
The problem I'm seeing is that BlackBerry API 7.x's Locale class only has constants for Spain Spanish and Mexican Spanish. Does that mean localization for Spanish speaking countries such as Panama, Argentina, Colombia, etc. get a default localization as if it were Spain Spanish?
Also for this case where multiple variations of the same languages must be dealt with, how should I name the files? I tried adding locale_es-AR.rrc but the - is not admissible on Resource files names, but I don't know if locale_es_AR.rrc is the correct format.
I want to know before adding ten Resource files for these countries that may or may not be usable.
Is it possible what I'm looking for?
What you are trying is correct. Have a look at Localizing Your Files
This file must have the same name as the resource header file,
followed by an underscore (_) and the language code, and then,
optionally, by a single underscore (_) and a country code (for
example, AppName_en_GB.rrc).

Geo IP and country/region/city DB

Have a nice day!
Could you please advise me free accurate multilingual DB (with frequent updatings) for:
locate country+region+city (maybe +time zone) by IP (from PHP);
build dropdown list country/region/city on site (that is, for example, get
from PHP regions by country and city by region/country). Names of
countries/regions/cities must be in different languages.
Thank you!
MaxMind's GeoIP2 and GeoLite2 databases support multiple languages. They currently include German, English, Spanish, French, Japanese, Portuguese, Russian, and Simplified Chinese. You can also use the included geoname_id to look up the location using GeoNames to get the location names in other languages.
There is also a PHP API for the format.

setting up a countries table for Rails i18n

In preparation to internationalize our Rails app, I'm finding we need to create a countries table and model that would contain (among other things) the default locale for each country. I found a 4 year old resource http://snippets.dzone.com/posts/show/1727 that has most of what I want, but not locale. Does everybody have to piece this part together by hand or am I overlooking some easier way to map country to a default locale.
P.S. We already look up a users country using GeoIpCountry which works nicely, but that table only provides country name and 2-letter abbreviation. I also want to use country to assign the users default locale, currency, and 3-letter abbreviation (needed by a third party integration)
The best way to identify user's locale is to look up the HTTP request's Accept-Language setting.
e.g., mine says: Accept-Language: fr-BE
Which gives you my locale, my language (fr: french) and my country (BE: Belgium).
Also, remember that locale identification based on country is wrong in many countries, such as mine: Many websites identify my country (Belgium) correctly and assume a default locale: nl-BE because 60% of belgian people speak Dutch (nl). Hence these sites have it wrong for 40% of belgian visitors (including me).
Their site is a bad experience for me because it displays in a language which is not mine and the first thing I must do is look for their tiny language popup menu.
Had they simply looked up my Accept-Language, they would have shown me their site in my language right away.
have a look at: https://github.com/mm1/country-list

How to set language of web page determined by visitor language

Can someone tell me how to set language of a web page on the knowledge of IP address of visitor so that he automatically gets page in his country's language. Of course if that language is implemented by web developer. Even better I sow some examples of automatic Google translation of the text.
So how to achieve that visitor from USA gets text on my page in English and visitor from France in French. All that translated by Google from some third original language.
Thanks a lot.
When it come to automatic language selection I'd go the mod_rewrite route if you're using Apache. It's easier to change in a production environment that touching application code. mod_rewrite grabs the "Accept-Language" out of the header then applies the rewrite rule.
RewriteCond %{HTTP:Accept-Language} ^fr [NC]
RewriteRule ^$ /fr/ [L,R=301]
You can stack the rewrite conditions and rules to work as a catch all language variations (fr, fr-ca, fr-fr, fr-mo, fr-ch all go to fr)
Checkout the official mod-rewrite documentation
good language example:
http://tech-blog.borychowski.com/index.php/2009/03/htaccess/redirect-according-to-browser-language-mod-rewrite-and-http_accept_language/
Once you push the user to the right general language (when none is defined in the URL) the application can set a session language, write links with the set lang. It's also good to allow people to change language on the fly since most users in bilingual locals (i.e. Quebec) work in more than one language. I've worked with French speaking programmers who prefer reading technical documents in English.
When it comes to Google translating text I'd be careful. If you're doing any e-commerce transaction your international customers (or local customers with international browser settings) may get incorrect or inaccurate product information, descriptions and "terms and conditions". If you don't save the exact Google translation text to your DB for every on the fly translation there is no way to track what the user has committed to in their language. Some non-translated legal copy may be in order.
I hope this helps.
Either:
Guess language from location (which you can get from their IP).
Look at the request header's "accept-language" value.
To see what's in your request header, have a look here: http://www.ericgiguere.com/tools/http-header-viewer.html
This is a bad idea from the offset.
Geolocating on IP address doesn't always work (and doesn't work if you use TOR)
Even if you get this right, what would you do for countries like Canada or Switzerland?
Automatic translation is ok, but it would be better to tell someone that you don't have the site in their language - they may then prefer to read it in a different language.

Resources