org.nuiton.i18n
Class I18nLanguage

java.lang.Object
  extended by org.nuiton.i18n.I18nLanguage

public class I18nLanguage
extends Object

Represents a language in i18n system with all his translations.

To obtain a translation, use the method translate(String)

Since:
1.1
Author:
tchemit

Field Summary
protected  Locale locale
          la locale de la langue
protected  String recordFilePath
          Indique le chemin du fichier dans lequel ecrire les entrees non trouvees
protected  Properties resource
          toutes les traductions pour cette langue
 
Constructor Summary
I18nLanguage(Locale l)
           
I18nLanguage(Locale locale, String recordFilePath)
           
 
Method Summary
 void close()
           
 boolean equals(Object o)
           
protected  void finalize()
           
 Locale getLocale()
           
 int hashCode()
           
 void load(I18nBundleEntry[] bundleEntries)
          Deprecated. since 2.4 use load(I18nBundleEntry[], Charset) instead, charset must be provided to avoid encoding problems
 void load(I18nBundleEntry[] bundleEntries, Charset encoding)
          charge les traductions de la languea partir d'une liste donnee de fichiers de traduction.
protected  void recordNotFound(String key)
           
 int size()
           
 String toString()
           
 String translate(String sentence)
          Translate takes a sentence and returns its translation if found, the very same string otherwise.
 String untranslate(String sentence)
          Untranslate takes a translated sentence and returns the original one if found, the very same string otherwise.
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

resource

protected Properties resource
toutes les traductions pour cette langue


locale

protected final Locale locale
la locale de la langue


recordFilePath

protected String recordFilePath
Indique le chemin du fichier dans lequel ecrire les entrees non trouvees

Constructor Detail

I18nLanguage

public I18nLanguage(Locale l)

I18nLanguage

public I18nLanguage(Locale locale,
                    String recordFilePath)
Method Detail

load

@Deprecated
public void load(I18nBundleEntry[] bundleEntries)
Deprecated. since 2.4 use load(I18nBundleEntry[], Charset) instead, charset must be provided to avoid encoding problems

charge les traductions de la languea partir d'une liste donnee de fichiers de traduction.

Parameters:
bundleEntries - the used bundles entries to load

load

public void load(I18nBundleEntry[] bundleEntries,
                 Charset encoding)
charge les traductions de la languea partir d'une liste donnee de fichiers de traduction.

Parameters:
bundleEntries - the used bundles entries to load
encoding - Charset to use for Properties loading
Since:
2.4

translate

public String translate(String sentence)
Translate takes a sentence and returns its translation if found, the very same string otherwise.

Parameters:
sentence - sentence to translate
Returns:
translated sentence

recordNotFound

protected void recordNotFound(String key)

untranslate

public String untranslate(String sentence)
Untranslate takes a translated sentence and returns the original one if found, the very same string otherwise.

Parameters:
sentence - sentence to untranslate
Returns:
untranslated sentence

getLocale

public Locale getLocale()

size

public int size()

close

public void close()

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2011 CodeLutin. All Rights Reserved.