Language of Location Chooser (Web version)

Any questions? Any answers?
pebarna

Language of Location Chooser (Web version)

Post by pebarna »

Hello. I didnt find inside the documentation or FAQs how to set by parameter the language of the location Chooser.
Meanwhile the widget respong well to the parameter lang, the Location Chooser continue showing the texts in english.

I mean the texts "Major cities" and "All locations", would be great is also can appear the translation of the countries and cities in the dropdown list to the desired language, but at least, I am settle to know how to change the language of the external texts.

Thank in advance.
User avatar
countryroads
Posts: 8844
Joined: Tue Apr 27, 2010 3:38 am
Name: Marty
Location: Mansfield, Ohio USA
Contact:

Re: Language of Location Chooser (Web version)

Post by countryroads »

Hi Pedro,

Welcome to YoWindow.

In the Location Chooser code, you will find the following -

I have put some examples in the code, uncomment to see them in effect
*/
var flashvars = {
location_id: "auto"
// landscape: "seaside",
// background: "#FFFFFF",
// lang: "de",
// unit_system: "metric",
// time_format: "24"
};

Uncomment the line that has "lang:" in it. Also replace the "de" with the abbreviation for your desired language.

Let us know how this works out for you.

Marty
pebarna

Re: Language of Location Chooser (Web version)

Post by pebarna »

Hello Marty, thanks for your quick answer.

Inside the code, the only place where is the list of commented parameters is inside the function
function installYoWidget() {

var flashvars = {
location_id: "auto",
lang: "es" <------------
// landscape: "seaside",

If make the parameter active in that point uncommenting it, that acts on the widget behaviour, but not on the Location Chooser.

Maybe this setting must to be more at the beginning of the code? Or must to be duplicated inside the function installLocationChooser? I will try to test this last.

Thanks in advance.
pebarna

Re: Language of Location Chooser (Web version)

Post by pebarna »

Hi again Marty.

I tried duplicating the setting of flashvars inside the function installLocationChooser.

function installLocationChooser() {
var flashvars = {
lang: "es"
};
var place = document.getElementById('location_chooser_place');

No changes, location chooser seems to be in love with English language. :)

( Of course, by chance, I cleaned the cache before the tries )
ikarus1969
Posts: 1645
Joined: Wed Nov 18, 2009 9:58 am
Location: Vienna, Austria

Re: Language of Location Chooser (Web version)

Post by ikarus1969 »

pebarna wrote:No changes, location chooser seems to be in love with English language. :)
No, no :wink: nothing lasts forever!

Do you mean something like this (in the background you see a copy of the location-chooser site (http://yowindow.com/example/lc_widget.php) and in the foreground the editor with the html-sourcecode):
YoWindow - location-chooser - localized Strings.jpg
I made it this way: defining an array called "window.LOCALE_STRINGS" as you can see in the screenshot and define the strings as you like.
Here: "Major cities" is replaced by the german localized version "Große Städte" and "All locations" was replaced by "Alle Orte".
»Man is impressive. In a universe full of untold secrets he has invented boredom.«
pebarna

Re: Language of Location Chooser (Web version)

Post by pebarna »

Hi Marty.. I don't know what is happening.

I added your arrray patch in my code and English remains.
Look at the attached screen snapshoot ( The page at background and the code at front ).

In one of my tries, Instead of the call to the js I tried using this code calling to the php module that only runned properly one time ( I could see the texts in Spanish ),

<script type="text/javascript" src="http://yowindow.com/js/yoloc.php?locale=es_ES"></script>

It runned well only one time but never more. in all subsequent tries, don't show anything, like it generate an error.

At first I suspected was a problem of the livesite builder that power my page but not..
Even If I execute your example in any of my browsers,(I tested on firefox, and chrome), shows the original strings in English.

Thanks
Attachments
Snapshoot
Snapshoot
pebarna

Re: Language of Location Chooser (Web version)

Post by pebarna »

Sorry. I forgot to mention. By the way, my windows locale is spanish spain
pebarna

Re: Language of Location Chooser (Web version)

Post by pebarna »

Hi Marty.

Could you find out any thing new about this issue?
I tried with different browsers, and not only in my site, also with the example you provided, (I added the array to the code) and also is not something belonging to my notebook, coz I tested in my phone browser with the same result,(The widget is not supported by android, but I can see the location chooser showing the texts in english ) that means the problem is not due my context particularly. isn't it?

I look forward for your reply.
ikarus1969
Posts: 1645
Joined: Wed Nov 18, 2009 9:58 am
Location: Vienna, Austria

Re: Language of Location Chooser (Web version)

Post by ikarus1969 »

Hi Pedro!

could you please tell us the url of the page which is not working so we can have a look at the (generated) source-code?

In the meantime: is it right that you are working with:
pebarna wrote:<script type="text/javascript" src="http://yowindow.com/js/yoloc.php?locale=es_ES"></script>
This php delivers JavaScript-code which defines two arrays: "LOCALE_STRINGS" and "ls" and set values to ls (and implicitly to LOCALE_STRINGS too)
The beginning of the delivered JavaScript:

Code: Select all

var LOCALE_STRINGS = {};
var LOCALE = "es_ES";
var ls = LOCALE_STRINGS;
ls["Major cities"] = "Grandes ciudades";
ls["All locations"] = "Todas las poblaciones";
ls["Retry"] = "Volver a intentar";
ls["Cancel"] = "Cancelar";
ls["Loading"] = "Cargando";
ls["Select a country"] = "Seleccione un país";
...and some more strings, of course.

So you have to take care that in any JavaScript code below the
pebarna wrote:<script type="text/javascript" src="http://yowindow.com/js/yoloc.php?locale=es_ES"></script>
you must not redefine neither LOCALE_STRINGS nor ls in any form because alle the strings set would be lost / reset.

Could you check that, please? That you don't reset neither "LOCALE_STRINGS" nor "ls"? Thank you! (and please don't forget to provide the URL of the not working site)
»Man is impressive. In a universe full of untold secrets he has invented boredom.«
pebarna

Re: Language of Location Chooser (Web version)

Post by pebarna »

Hi again Marty.

Yes, of course. This is the url of the page with your widget:

http://www.infobogus.com/pages/tiempo?lang=es

Anyway, I tried, uploading the example lc_widget.php you gave me to another domain of my own, adding your patch to the code, to test a clean code, and happens the same.

This is the url of your example in my domain: http://www.rungkit.com/test.html

Thanks again.
Post Reply