jiangzhendong / google-api-translate-java

Automatically exported from code.google.com/p/google-api-translate-java
0 stars 0 forks source link

Provide mapping from language abbreviations to full names #37

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The API currently provides a list of valid languages, but this list is only
provided as a set of abbreviations. It might be nice if there was a way
convert these abbreviations to their full names, e.g. "en" -> "English,
"de" -> "German", etc. 

A facility like this would make it easier for clients of the library to
upgrade (i.e. as new languages are added) since they wouldn't need to keep
their own abbreviation-to-name mapping up-to-date.

Original issue reported on code.google.com by austin.bingham on 15 Dec 2008 at 11:19

GoogleCodeExporter commented 8 years ago
These are already provided by com.google.api.translate.Language, unless I'm 
missing
something (quite possible!)

eg. Language.ENGLISH is the String "en", Language.GERMAN is the String "de".

Original comment by rich.mid...@gmail.com on 15 Dec 2008 at 8:57

GoogleCodeExporter commented 8 years ago
The mapping I want is from the abbreviations to strings for the full name of 
the 
language, "English" in the case of "en" or "German" in the case of "de". So, 
right 
now Language.ENGLISH resolves to the string "en". I'd like something additional 
like 
this: 

   com.google.api.translate.Language.fullName(Language.ENGLISH) => "English"
   com.google.api.translate.Language.fullName(Language.GERMAN) => "German"

Original comment by austin.bingham on 15 Dec 2008 at 9:06

GoogleCodeExporter commented 8 years ago
Ah, I see. I'll have to think about how I can accomplish that neatly.

I guess where you expect "English", "German", someone else might expect 
"Anglais",
"Allemand" and the next person might even expect "English", "Deutsch". As it 
stands I
think that's roughly some 40 Strings for you to maintain or some 1600 for me? 
There
should be a neat way to do it somehow though...

Original comment by rich.mid...@gmail.com on 15 Dec 2008 at 10:18

GoogleCodeExporter commented 8 years ago
Yeah, it had also occurred to me that you might want locale-specific full 
names. What 
you might be able to do is manually maintain a single set of full names in one 
language. Then, as a part of the build, generate the code for the rest of the 
translations using the translation service itself. This has the benefits of a) 
centralizing the maintenance of full names (i.e. in your library) while b) 
minimizing 
the maintenance load.

Original comment by austin.bingham on 17 Dec 2008 at 7:43