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 PropertiesFAKE_I18N_FILEstatic StringKEY_NOT_FOUNDprotected static Loggerloggercreate a static logger.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeViewLanguage(ContentContext ctx)voidforceReloadEdit(GlobalContext globalContext, javax.servlet.http.HttpSession session, String lg)StringgetAllText(String key, String defautlValue)Map<String,String>getCalendarEdit()return trad for calendarMap<String,String>getCalendarView()return trad for calendarStringgetComponentText(String componentPath, String key)StringgetContentViewText(String key)StringgetContentViewText(String key, String defaultValue)StringgetContextKey()MapgetCountries()MapgetCountries(ContentContext ctx)ModulegetCurrentModule()Map<String,String>getEdit()StringgetEditLg()StringgetHelpText(String key)Map<String,String>getHelpTranslation()static I18nAccessgetInstance(javax.servlet.http.HttpServletRequest request)call this method in view mode (language can change at any click).static I18nAccessgetInstance(ContentContext ctx)static I18nAccessgetInstance(GlobalContext globalContext, javax.servlet.http.HttpSession session)Collection<String>getMonths()Map<String,String>getRequestMap()StringgetTest()StringgetText(String key)StringgetText(String key, String notFoundValue)StringgetText(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.StringgetText(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.StringgetText(ContentContext ctx, String key)Map<String,String>getView()StringgetViewText(String key)StringgetViewText(String key, String defaultValue)StringgetViewText(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.StringgetViewText(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.booleanisDisplayKey()static voidmain(String[] args)voidrequestInit(ContentContext ctx)voidresetForceEditLg()voidresetRequestMap()voidresetViewLanguage(ContentContext ctx)voidsetContextKey(String contextKey)voidsetCurrentModule(GlobalContext globalContext, javax.servlet.http.HttpSession session, Module currentModule)voidsetRequestMap(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:
ServiceExceptionException
-
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:
FileNotFoundExceptionIOExceptionConfigurationException
-
getInstance
public static final I18nAccess getInstance(GlobalContext globalContext, javax.servlet.http.HttpSession session) throws FileNotFoundException, IOException
- Parameters:
session-- Returns:
- Throws:
FileNotFoundExceptionIOExceptionConfigurationException
-
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:
ServiceExceptionException
-
resetViewLanguage
public void resetViewLanguage(ContentContext ctx) throws ServiceException, Exception
- Throws:
ServiceExceptionException
-
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()
-
-