Package org.javlo.i18n
Class I18nAccess
- java.lang.Object
-
- org.javlo.i18n.I18nAccess
-
- All Implemented Interfaces:
Serializable
public class I18nAccess extends Object implements Serializable
- Author:
- pvanderm
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Properties
FAKE_I18N_FILE
static String
KEY_NOT_FOUND
protected static Logger
logger
create a static logger.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeViewLanguage(ContentContext ctx)
void
forceReloadEdit(GlobalContext globalContext, javax.servlet.http.HttpSession session, String lg)
String
getAllText(String key, String defautlValue)
Map<String,String>
getCalendarEdit()
return trad for calendarMap<String,String>
getCalendarView()
return trad for calendarString
getComponentText(String componentPath, String key)
String
getContentViewText(String key)
String
getContentViewText(String key, String defaultValue)
String
getContextKey()
Map
getCountries()
Map
getCountries(ContentContext ctx)
Module
getCurrentModule()
Map<String,String>
getEdit()
String
getEditLg()
String
getHelpText(String key)
Map<String,String>
getHelpTranslation()
static I18nAccess
getInstance(javax.servlet.http.HttpServletRequest request)
call this method in view mode (language can change at any click).static I18nAccess
getInstance(ContentContext ctx)
static I18nAccess
getInstance(GlobalContext globalContext, javax.servlet.http.HttpSession session)
Collection<String>
getMonths()
Map<String,String>
getRequestMap()
String
getTest()
String
getText(String key)
String
getText(String key, String notFoundValue)
String
getText(String key, String[][] balises)
replace the balise in text, value of balise is defined in the array. you can defined a balise as : ${balise_name}, this balise is replace with the value of balise name in the array. if the value is not found the balise is not replaced.String
getText(String key, Map<?,?> balises)
replace the balise in text, value of balise is defined in the map. you can defined a balise as : ${balise_name}, this balise is replace with the value of balise name in the map. if the value is not found the balise is not replaced.String
getText(ContentContext ctx, String key)
Map<String,String>
getView()
String
getViewText(String key)
String
getViewText(String key, String defaultValue)
String
getViewText(String key, String[][] balises)
replace the balise in text, value of balise is defined in the array. you can defined a balise as : ${balise_name}, this balise is replace with the value of balise name in the array. if the value is not found the balise is not replaced.String
getViewText(String key, Map<?,?> balises)
replace the balise in text, value of balise is defined in the map. you can defined a balise as : ${balise_name}, this balise is replace with the value of balise name in the map. if the value is not found the balise is not replaced.boolean
isDisplayKey()
static void
main(String[] args)
void
requestInit(ContentContext ctx)
void
resetForceEditLg()
void
resetRequestMap()
void
resetViewLanguage(ContentContext ctx)
void
setContextKey(String contextKey)
void
setCurrentModule(GlobalContext globalContext, javax.servlet.http.HttpSession session, Module currentModule)
void
setRequestMap(Map<String,String> requestMap)
-
-
-
Field Detail
-
logger
protected static Logger logger
create a static logger.
-
FAKE_I18N_FILE
public static final Properties FAKE_I18N_FILE
-
KEY_NOT_FOUND
public static final String KEY_NOT_FOUND
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static I18nAccess getInstance(ContentContext ctx) throws ServiceException, Exception
- Throws:
ServiceException
Exception
-
getInstance
public static final I18nAccess getInstance(javax.servlet.http.HttpServletRequest request) throws FileNotFoundException, IOException
call this method in view mode (language can change at any click).- Parameters:
request
- the request- Returns:
- Throws:
FileNotFoundException
IOException
ConfigurationException
-
getInstance
public static final I18nAccess getInstance(GlobalContext globalContext, javax.servlet.http.HttpSession session) throws FileNotFoundException, IOException
- Parameters:
session
-- Returns:
- Throws:
FileNotFoundException
IOException
ConfigurationException
-
setCurrentModule
public void setCurrentModule(GlobalContext globalContext, javax.servlet.http.HttpSession session, Module currentModule) throws IOException
- Throws:
IOException
-
getCurrentModule
public Module getCurrentModule()
-
changeViewLanguage
public void changeViewLanguage(ContentContext ctx) throws ServiceException, Exception
- Throws:
ServiceException
Exception
-
resetViewLanguage
public void resetViewLanguage(ContentContext ctx) throws ServiceException, Exception
- Throws:
ServiceException
Exception
-
getCountries
public Map getCountries(ContentContext ctx) throws Exception
- Throws:
Exception
-
main
public static void main(String[] args)
-
getTest
public String getTest()
-
getText
public String getText(ContentContext ctx, String key)
-
getText
public String getText(String key, Map<?,?> balises)
replace the balise in text, value of balise is defined in the map. you can defined a balise as : ${balise_name}, this balise is replace with the value of balise name in the map. if the value is not found the balise is not replaced.- Parameters:
key
- the key of i18n textbalises
- in map with [ balise_name, balise_value ]- Returns:
- a string with balise replace.
-
getText
public String getText(String key, String[][] balises)
replace the balise in text, value of balise is defined in the array. you can defined a balise as : ${balise_name}, this balise is replace with the value of balise name in the array. if the value is not found the balise is not replaced.- Parameters:
key
- the key of i18n textbalises
- in array with [ balise_name, balise_value ]- Returns:
- a string with balise replace.
-
getViewText
public String getViewText(String key, Map<?,?> balises)
replace the balise in text, value of balise is defined in the map. you can defined a balise as : ${balise_name}, this balise is replace with the value of balise name in the map. if the value is not found the balise is not replaced.- Parameters:
key
- the key of i18n textbalises
- in map with [ balise_name, balise_value ]- Returns:
- a string with balise replace.
-
getViewText
public String getViewText(String key, String[][] balises)
replace the balise in text, value of balise is defined in the array. you can defined a balise as : ${balise_name}, this balise is replace with the value of balise name in the array. if the value is not found the balise is not replaced.- Parameters:
key
- the key of i18n textbalises
- in array with [ balise_name, balise_value ]- Returns:
- a string with balise replace.
-
getEditLg
public String getEditLg()
-
resetForceEditLg
public void resetForceEditLg()
-
forceReloadEdit
public void forceReloadEdit(GlobalContext globalContext, javax.servlet.http.HttpSession session, String lg) throws IOException
- Throws:
IOException
-
requestInit
public void requestInit(ContentContext ctx) throws Exception
- Throws:
Exception
-
isDisplayKey
public boolean isDisplayKey()
-
getContextKey
public String getContextKey()
-
setContextKey
public void setContextKey(String contextKey)
-
getMonths
public Collection<String> getMonths()
-
resetRequestMap
public void resetRequestMap()
-
-