This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
View Entire Thread
Re: Help with translating webpage

Well, I took a look at the Javascript for the language translation and found the error.

The process used, on the page you linked to, is rather simple. Two "div" structures are set up. One is set to "display:block" and the other to "display:none". The original text, in English, is in the one set for "display:block" and the other, which is initially blank, is set to "display:none". When a translation is selected, the English text is read from the "div" and then translated through Google. The returned translation is inserted in the hidden "div" and then the "display" attributes are switched. This then hides the "div" with the English text and displays the "div" with the translation.

Switching back to English does not require a translation. All that happens is the "display" attributes for the two "divs" are switched again. But switching back to English, and then switching to another language, did not work. When the page initially loads, both "div"s are set to "display:block". Since the translation "div" is empty, nothing shows. When a translation is selected, the "div" containing the English is set to "display:none" and the translated text is inserted in the translation "div". When you switch back to English, the "display" attribute for both "div" is flipped.

But if you then select another translation, the Javascript re-translates the English text, but fails to reset the translation "div" to "display:block". A one line addition is all it needed. If you are going to use the same code, I can send you the fix.

But the original question was about using flags instead of text. After thinking about it for a while, using flags would be a bad idea. Flags represent countries, not languages. Any particular country can host people with different languages and many languages are spoken in many different countries. Stick with the text links if you doing language translation.

Browser: Firefox

OS: Solaris, Redhat, Fedora, Suse