balazs-endresz / jquery-translate

Automatically exported from code.google.com/p/jquery-translate
5 stars 5 forks source link

adding alternative language codes #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Translation to or from the language Hebrew "he" doesn't work.
2. Translation to or from the language code "iw" does work. 

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
1.3.7

Please provide any additional information below.
The language code for Hebrew changed from "iw" to "he" in 1989. The Google
language API uses "iw" for some reason.

I'm using the jquery-translate plugin for my WordPress plugin here:
http://wordpress.org/extend/plugins/google-ajax-translation/

Before calling the jquery-translate function I convert the language code
with this JavaScript:
lang = ('he' == lang) ? 'iw' : lang;

See also:
http://code.google.com/p/google-ajax-apis/issues/detail?id=178

Original issue reported on code.google.com by monodist...@gmail.com on 24 Jun 2009 at 4:21

GoogleCodeExporter commented 9 years ago
I think I'll leave this issue right now, because I don't want to break any code 
in a 
minor version, but I'll tackle it in v1.4 soon. I guess it'd be better to 
follow the 
standards and convert to "he" automatically.

Original comment by balazs.endresz on 24 Jun 2009 at 10:16

GoogleCodeExporter commented 9 years ago
A couple of other codes which should change...

The code for Malay should change from “ms” to “zlm”.  “ms” is now a 
“macrolanguage” (language group) which includes Indonesian(!) as well as 
peninsular 
Malaysian.  See:
  http://www.ethnologue.com/show_language.asp?code=zlm
  http://www.ethnologue.com/show_language.asp?code=msa
  http://www.sil.org/iso639-3/documentation.asp?id=msa

The code for “Chinese (Simplified)” should change from “zh-CN” to 
“zh-Hans”.  See:
  http://en.wikipedia.org/wiki/Simplified_Chinese_characters#Web_pages
Before the script tags “Hans” (Simplified) and “Hant” became available, 
the practice 
arose of using the country codes for mainland China (“CN”) and Taiwan 
(“TW”) as an 
ad-hoc method of distinguishing the Simplified and Traditional Chinese scripts. 
 But 
this is now deprecated.

Original comment by caoimhin...@gmail.com on 5 Sep 2009 at 6:47

GoogleCodeExporter commented 9 years ago
Malay is detected by the Google translate API but not translated so I'm sure if 
that
applies to this plugin.

While the W3C recommends the language codes "zh-Hant" and "zh-Hans" there are 
some
reservations too. This document is from 2007.
http://www.w3.org/TR/i18n-html-tech-lang/#ri20040429.113217290

In the Options for Firefox version 3.5 you can set the preferred language to 
"zh",
"zh-cn", "zh-hk", "zh-sg", and "zh-tw". I'm not sure what codes other browsers 
use.

Original comment by monodist...@gmail.com on 6 Sep 2009 at 2:14

GoogleCodeExporter commented 9 years ago
Thanks for the info guys, I'll include all of these in the next version (1.4) 
sometime 
this month.
Btw, these will be handled by the `toLanguageCode` (and `toLanguage`) method, 
so it will 
convert them to the one used by the Language API. That means that they will be 
converted 
on each instantiation too.

Original comment by balazs.endresz on 7 Sep 2009 at 6:53

GoogleCodeExporter commented 9 years ago
You can download the newer version here: http://jquery-translate.appspot.com/

I forgot to include "zh-hk" and "zh-sg", will do it tomorrow. But you can also
specify any other language codes as well:

$.translate.languageCodeMap["zh-hk"] = "zh-CN";
$.translate.languageCodeMap["zh-sg"] = "zh-TW";

Original comment by balazs.endresz on 3 Oct 2009 at 2:14

GoogleCodeExporter commented 9 years ago
So, in 1.4.0 the mapping looks like this:

//keys must be lower case, and values must equal to a 
//language code specified in the Language API
languageCodeMap: {
"he": "iw",
"zlm": "ms",
"zh-hans": "zh-CN",
"zh-hant": "zh-TW"
},

And I'm thinking about adding these below but I'm not quite sure if it's 
correct:

"zh-hk": "zh-TW",
"zh-sg": "zh-CN"

http://stackoverflow.com/questions/732109/chinese-language-codes
based on this I could also add "zh-mo":"zh-TW", but it's not really clear for 
me 
if they are the same dialects or what exactly is the difference between them,
what do you think, are these appropriate?

Original comment by balazs.endresz on 3 Oct 2009 at 4:04

GoogleCodeExporter commented 9 years ago

Original comment by balazs.endresz on 18 Oct 2009 at 8:08

GoogleCodeExporter commented 9 years ago

Original comment by balazs.endresz on 24 Oct 2009 at 1:05

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I was just working on a bug report I got for my WordPress plugin:
http://wordpress.org/support/topic/325929?replies=1

The problem was that the translation into Portuguese didn't work. I poked with 
the
Firebug console in my code, in your code, and then finally tried out:
jQuery.translate.getLanguages()
and saw that Google uses "pt-PT" for Portuguese (from Portugal rather than 
Brazil or
other contries.)

I can fix this in my code now of course but this may be worth adding to the
languageCodeMap array.

Firefox only includes "pt" and "pt-br" in its language preferences.

Original comment by monodist...@gmail.com on 29 Oct 2009 at 11:57

GoogleCodeExporter commented 9 years ago
Thanks, I will add this in the next version!

Original comment by balazs.endresz on 30 Oct 2009 at 12:18

GoogleCodeExporter commented 9 years ago
$.translate.languageCodeMap["pt"] = "pt-PT" added. Please reopen this ticket if 
you
find any other similar issue!

Original comment by balazs.endresz on 28 Jan 2010 at 6:13