de.enough.polish.ant.build
Class LocalizationSetting

java.lang.Object
  extended by de.enough.polish.ant.ConditionalElement
      extended by de.enough.polish.ant.Setting
          extended by de.enough.polish.ant.build.LocalizationSetting

public class LocalizationSetting
extends Setting

Stores the localization settings.

Copyright Enough Software 2004 - 2011

 history
        09-Sep-2004 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Constructor Summary
LocalizationSetting()
          Creates an empty setting
 
Method Summary
 void addConfiguredLocale(LocaleSetting setting)
          Adds a specific setting for a locale, this can be used for allowing different locale dependent encodings, for example.
 void addConfiguredLocalesetting(LocaleSetting setting)
          Adds a specific setting for a locale, this can be used for allowing different locale dependent encodings, for example.
 void addConfiguredLocaleSetting(LocaleSetting setting)
          Adds a specific setting for a locale, this can be used for allowing different locale dependent encodings, for example.
 LocaleSetting getDefaultLocale()
          Retrieves the default locale.
 String getExternalMessagesFileName()
          Retrieves the file-name containing the messages for localizations which should be loaded at a later stage.
 String getMessagesFileName()
          Retrieves the file-name containing the messages for localizations.
 String getPreprocessorClassName()
          Retrieves the name of the preprocessor class.
 LocaleSetting[] getSupportedLocales(Environment env)
          Retrieves all supported locales.
 String getSupportedLocalesAsString(Environment env)
          Retrieves all supported locale as a comma separated string, e.g.
 String getTranslationManagerClassName()
          Retrieves the name of the translation manager class.
 boolean includeAllLocales()
          Determines whether all found locales should be included.
 boolean isDynamic()
          Determines whether dynamic translations should be supported.
 boolean isValid()
          Checks if this localization setting is valid
 void setDefault(String locale)
          Sets the default locale.
 void setDefaultLocale(String locale)
          Sets the default locale.
 void setDynamic(boolean dynamic)
          Defines whether dynamic translations should be supported.
 void setExternalMessages(String messages)
          Sets the name of messages-files which can be loaded later after application start, e.g.
 void setLocale(String locale)
          Sets a single locale
 void setLocales(String supportedLocalesStr)
          Sets the locales which should be supported during this build.
 void setMessages(String messages)
          Sets the name of messages-files.
 void setPreprocessor(String preprocessorClassName)
          Sets the name of the preprocessor class.
 void setTranslationManager(String translationManagerClassName)
          Sets the name of the translation manager class.
 
Methods inherited from class de.enough.polish.ant.Setting
addConfiguredParameter, getAllParameters, getParameters, hasParameters
 
Methods inherited from class de.enough.polish.ant.ConditionalElement
getCondition, getIf, getUnless, isActive, isActive, isActive, isActive, setIf, setUnless
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizationSetting

public LocalizationSetting()
Creates an empty setting

Method Detail

addConfiguredLocaleSetting

public void addConfiguredLocaleSetting(LocaleSetting setting)
Adds a specific setting for a locale, this can be used for allowing different locale dependent encodings, for example.

Parameters:
setting - the setting

addConfiguredLocalesetting

public void addConfiguredLocalesetting(LocaleSetting setting)
Adds a specific setting for a locale, this can be used for allowing different locale dependent encodings, for example.

Parameters:
setting - the setting

addConfiguredLocale

public void addConfiguredLocale(LocaleSetting setting)
Adds a specific setting for a locale, this can be used for allowing different locale dependent encodings, for example.

Parameters:
setting - the setting

getSupportedLocales

public LocaleSetting[] getSupportedLocales(Environment env)
Retrieves all supported locales. This will return null when all found locales should be included.

Parameters:
env - the environment
Returns:
Returns the supported locales.

setLocales

public void setLocales(String supportedLocalesStr)
Sets the locales which should be supported during this build.

Parameters:
supportedLocalesStr - The locales which should be supported or "*" for all found locales.

setLocale

public void setLocale(String locale)
Sets a single locale

Parameters:
locale - the supported locale

includeAllLocales

public boolean includeAllLocales()
Determines whether all found locales should be included.

Returns:
Returns true when all found locales should be included.

setMessages

public void setMessages(String messages)
Sets the name of messages-files. The default name is "messages.txt".

Parameters:
messages - the name of files containing the messages.

getMessagesFileName

public String getMessagesFileName()
Retrieves the file-name containing the messages for localizations.

Returns:
"messages.txt" or similar

setExternalMessages

public void setExternalMessages(String messages)
Sets the name of messages-files which can be loaded later after application start, e.g. by downloading the dist/en.loc via HTTP later onwards. The default name is "messages_external.txt".

Parameters:
messages - the name of files containing the messages.

getExternalMessagesFileName

public String getExternalMessagesFileName()
Retrieves the file-name containing the messages for localizations which should be loaded at a later stage.

Returns:
"messages_external.txt" or similar

isDynamic

public boolean isDynamic()
Determines whether dynamic translations should be supported. Dynamic translations can be changed during runtime with the Locale.loadTranslations(...)-method.

Returns:
true when dynamic translations should be supported.

setDynamic

public void setDynamic(boolean dynamic)
Defines whether dynamic translations should be supported. Dynamic translations can be changed during runtime with the Locale.loadTranslations(...)-method.

Parameters:
dynamic - true when dynamic translations should be supported.

setDefault

public void setDefault(String locale)
Sets the default locale. This is the locale that is loaded upon start of the application by the de.enough.polish.util.Locale class.

Parameters:
locale - the default locale, e.g. "en_US"
See Also:
setDefaultLocale(String)

setDefaultLocale

public void setDefaultLocale(String locale)
Sets the default locale. This is the locale that is loaded upon start of the application by the de.enough.polish.util.Locale class.

Parameters:
locale - the default locale, e.g. "en_US"

getDefaultLocale

public LocaleSetting getDefaultLocale()
Retrieves the default locale. This call makes only sense when dynamic locales are used.

Returns:
the default locale

getPreprocessorClassName

public String getPreprocessorClassName()
Retrieves the name of the preprocessor class.

Returns:
the name of the preprocessor class

setPreprocessor

public void setPreprocessor(String preprocessorClassName)
Sets the name of the preprocessor class.

Parameters:
preprocessorClassName - the class name of the preprocessor

getTranslationManagerClassName

public String getTranslationManagerClassName()
Retrieves the name of the translation manager class.

Returns:
the name of the translation manager class

setTranslationManager

public void setTranslationManager(String translationManagerClassName)
Sets the name of the translation manager class.

Parameters:
translationManagerClassName - the class name of the translation manager

getSupportedLocalesAsString

public String getSupportedLocalesAsString(Environment env)
Retrieves all supported locale as a comma separated string, e.g. "de,en,fr"

Parameters:
env - the environment
Returns:
all supported locale as a comma separated string

isValid

public boolean isValid()
Checks if this localization setting is valid

Returns:
true when it is valid