Class I18nInitializer

java.lang.Object
org.nuiton.i18n.init.I18nInitializer
Direct Known Subclasses:
ClassPathI18nInitializer, DefaultI18nInitializer

public abstract class I18nInitializer
extends java.lang.Object
Abstract object to resolv I18nBundle and prepare initialization of I18n.
Since:
1.1
Author:
Tony Chemit - chemit@codelutin.com, Florian Desbois
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.nio.charset.Charset encoding
    Encoding used to load i18n bundles.
    protected I18nMessageFormatter messageFormatter
    Message formatter used in I18n to produce final translated messages.
    protected boolean missingKeyReturnNull
    Used to know if the I18nLanguage has to return null when a key is not found.
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected I18nInitializer()  
  • Method Summary

    Modifier and Type Method Description
    java.nio.charset.Charset getEncoding()
    Get the Charset encoding used for i18n Properties file loading.
    I18nMessageFormatter getMessageFormatter()
    Get the I18nMessageFormatter to use on each i18n message translation.
    boolean isMissingKeyReturnNull()
    Get the missingKeyReturnNull to use on missing key
    abstract I18nBundle[] resolvBundles()
    Resolv the bundles.
    I18nBundle[] resolvBundles​(java.net.URL... urls)  
    void setEncoding​(java.nio.charset.Charset encoding)
    Set encoding to use for i18n Properties file loading.
    void setMessageFormatter​(I18nMessageFormatter messageFormatter)
    Set messageFormatter to use on each i18n message translation.
    void setMissingKeyReturnNull​(boolean missingKeyReturnNull)
    Get the missingKeyReturnNull to use on missing key

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • encoding

      protected java.nio.charset.Charset encoding
      Encoding used to load i18n bundles.
      Since:
      2.4
    • messageFormatter

      protected I18nMessageFormatter messageFormatter
      Message formatter used in I18n to produce final translated messages.
      Since:
      2.4
    • missingKeyReturnNull

      protected boolean missingKeyReturnNull
      Used to know if the I18nLanguage has to return null when a key is not found.
      Since:
      2.4.1
  • Constructor Details

  • Method Details

    • resolvBundles

      public abstract I18nBundle[] resolvBundles() throws java.lang.Exception
      Resolv the bundles.
      Returns:
      the bundles detected
      Throws:
      java.lang.Exception - if any pb while getting bundles
    • resolvBundles

      public I18nBundle[] resolvBundles​(java.net.URL... urls) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • getEncoding

      public java.nio.charset.Charset getEncoding()
      Get the Charset encoding used for i18n Properties file loading.
      Returns:
      encoding to use
      Since:
      2.4
    • setEncoding

      public void setEncoding​(java.nio.charset.Charset encoding) throws java.lang.NullPointerException
      Set encoding to use for i18n Properties file loading.
      Parameters:
      encoding - Charset encoding to use
      Throws:
      java.lang.NullPointerException - if encoding is null
      Since:
      2.4
    • getMessageFormatter

      public I18nMessageFormatter getMessageFormatter()
      Get the I18nMessageFormatter to use on each i18n message translation.
      Returns:
      formatter to use
      Since:
      2.4
    • setMessageFormatter

      public void setMessageFormatter​(I18nMessageFormatter messageFormatter) throws java.lang.NullPointerException
      Set messageFormatter to use on each i18n message translation.
      Parameters:
      messageFormatter - I18nMessageFormatter to use
      Throws:
      java.lang.NullPointerException - if messageFormatter is null
      Since:
      2.4
    • isMissingKeyReturnNull

      public boolean isMissingKeyReturnNull()
      Get the missingKeyReturnNull to use on missing key
      Returns:
      the missingKeyReturnNull parameter
      Since:
      2.4.1
    • setMissingKeyReturnNull

      public void setMissingKeyReturnNull​(boolean missingKeyReturnNull)
      Get the missingKeyReturnNull to use on missing key
      Parameters:
      missingKeyReturnNull - missingKeyReturnNull to use
      Since:
      2.4.1