com.memetix.mst.language
Enum Language

java.lang.Object
  extended by java.lang.Enum<Language>
      extended by com.memetix.mst.language.Language
All Implemented Interfaces:
Serializable, Comparable<Language>

public enum Language
extends Enum<Language>

Language - an enum of all language codes supported by the Microsoft Translator API Uses the AJAX Interface V2 - see: http://msdn.microsoft.com/en-us/library/ff512399.aspx

Author:
Jonathan Griggs

Enum Constant Summary
ARABIC
           
AUTO_DETECT
           
BULGARIAN
           
CATALAN
           
CHINESE_SIMPLIFIED
           
CHINESE_TRADITIONAL
           
CZECH
           
DANISH
           
DUTCH
           
ENGLISH
           
ESTONIAN
           
FINNISH
           
FRENCH
           
GERMAN
           
GREEK
           
HAITIAN_CREOLE
           
HEBREW
           
HINDI
           
HMONG_DAW
           
HUNGARIAN
           
INDONESIAN
           
ITALIAN
           
JAPANESE
           
KOREAN
           
LATVIAN
           
LITHUANIAN
           
NORWEGIAN
           
POLISH
           
PORTUGUESE
           
ROMANIAN
           
RUSSIAN
           
SLOVAK
           
SLOVENIAN
           
SPANISH
           
SWEDISH
           
THAI
           
TURKISH
           
UKRAINIAN
           
VIETNAMESE
           
 
Method Summary
static void flushNameCache()
           
static Language fromString(String pLanguage)
           
static List<String> getLanguageCodesForTranslation()
           
 String getName(Language locale)
          getName() Returns the name for this language in the tongue of the specified locale If the name is not cached, then it retrieves the name of ALL languages in this locale.
static void setClientId(String pId)
           
static void setClientSecret(String pSecret)
           
static void setKey(String pKey)
           
 String toString()
          Returns the String representation of this language.
static Language valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Language[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
static Map<String,Language> values(Language locale)
          values(Language locale) Returns a map of all languages, keyed and sorted by the localized name in the tongue of the specified locale It returns a map, sorted alphanumerically by the keys() Key: The localized language name Value: The Language instance
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

AUTO_DETECT

public static final Language AUTO_DETECT

ARABIC

public static final Language ARABIC

BULGARIAN

public static final Language BULGARIAN

CATALAN

public static final Language CATALAN

CHINESE_SIMPLIFIED

public static final Language CHINESE_SIMPLIFIED

CHINESE_TRADITIONAL

public static final Language CHINESE_TRADITIONAL

CZECH

public static final Language CZECH

DANISH

public static final Language DANISH

DUTCH

public static final Language DUTCH

ENGLISH

public static final Language ENGLISH

ESTONIAN

public static final Language ESTONIAN

FINNISH

public static final Language FINNISH

FRENCH

public static final Language FRENCH

GERMAN

public static final Language GERMAN

GREEK

public static final Language GREEK

HAITIAN_CREOLE

public static final Language HAITIAN_CREOLE

HEBREW

public static final Language HEBREW

HINDI

public static final Language HINDI

HMONG_DAW

public static final Language HMONG_DAW

HUNGARIAN

public static final Language HUNGARIAN

INDONESIAN

public static final Language INDONESIAN

ITALIAN

public static final Language ITALIAN

JAPANESE

public static final Language JAPANESE

KOREAN

public static final Language KOREAN

LATVIAN

public static final Language LATVIAN

LITHUANIAN

public static final Language LITHUANIAN

NORWEGIAN

public static final Language NORWEGIAN

POLISH

public static final Language POLISH

PORTUGUESE

public static final Language PORTUGUESE

ROMANIAN

public static final Language ROMANIAN

RUSSIAN

public static final Language RUSSIAN

SLOVAK

public static final Language SLOVAK

SLOVENIAN

public static final Language SLOVENIAN

SPANISH

public static final Language SPANISH

SWEDISH

public static final Language SWEDISH

THAI

public static final Language THAI

TURKISH

public static final Language TURKISH

UKRAINIAN

public static final Language UKRAINIAN

VIETNAMESE

public static final Language VIETNAMESE
Method Detail

values

public static Language[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Language c : Language.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Language valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

fromString

public static Language fromString(String pLanguage)

toString

public String toString()
Returns the String representation of this language.

Overrides:
toString in class Enum<Language>
Returns:
The String representation of this language.

setKey

public static void setKey(String pKey)

setClientId

public static void setClientId(String pId)

setClientSecret

public static void setClientSecret(String pSecret)

getName

public String getName(Language locale)
               throws Exception
getName() Returns the name for this language in the tongue of the specified locale If the name is not cached, then it retrieves the name of ALL languages in this locale. This is not bad behavior for 2 reasons: 1) We can make a reasonable assumption that the client will request the name of another language in the same locale 2) The GetLanguageNames service call expects an array and therefore we can retrieve ALL names in the same, single call anyway.

Returns:
The String representation of this language's localized Name.
Throws:
Exception

getLanguageCodesForTranslation

public static List<String> getLanguageCodesForTranslation()
                                                   throws Exception
Throws:
Exception

values

public static Map<String,Language> values(Language locale)
                                   throws Exception
values(Language locale) Returns a map of all languages, keyed and sorted by the localized name in the tongue of the specified locale It returns a map, sorted alphanumerically by the keys() Key: The localized language name Value: The Language instance

Parameters:
locale - The Language we should localize the Language names with
Returns:
A Map of all supported languages stored by their localized name.
Throws:
Exception

flushNameCache

public static void flushNameCache()


Copyright © 2012. All Rights Reserved.