Package com.hybris.cockpitng.util.labels
Class ResourcesLabelLocator
- java.lang.Object
-
- com.hybris.cockpitng.util.labels.ResourcesLabelLocator
-
- All Implemented Interfaces:
org.zkoss.util.resource.LabelLocator2
public class ResourcesLabelLocator extends java.lang.Object implements org.zkoss.util.resource.LabelLocator2Label locator loading labels from resources. To activate and configure add a spring bean to your web spring xml file like this:<bean id="myLabelLocator" class="com.hybris.cockpitng.util.labels.ResourcesLabelLocator" scope="singleton" init-method="init" lazy-init="false"> <property name="location" value="/my/path/in/resources/labels"/> <property name="name" value="labels"/> </bean>
-
-
Constructor Summary
Constructors Constructor Description ResourcesLabelLocator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCharset()Returns "UTF-8".voidinit()Registers this label locator.java.io.InputStreamlocate(java.util.Locale locale)voidsetLocation(java.lang.String location)Sets the location of the localization files in resources.voidsetName(java.lang.String name)Sets the prefix of the label files.
-
-
-
Method Detail
-
init
public void init()
Registers this label locator. Should be specified as init-method if this will be registered as a spring bean.
-
setLocation
public void setLocation(java.lang.String location)
Sets the location of the localization files in resources. It must point to the package which contain the files. Example: '/my/path/in/resources/labels'.- Parameters:
location- location of the localization files within resources (a package)
-
setName
public void setName(java.lang.String name)
Sets the prefix of the label files. Will be used to locate the labels files in the specified location (@seesetLocation(String)). For example: setting the name to 'labels' will look for files with naming scheme labels_.properties where is the code of the current locale. (The default fallback file will be labels.properties in this case.) - Parameters:
name- prefix of the label files
-
locate
public java.io.InputStream locate(java.util.Locale locale)
- Specified by:
locatein interfaceorg.zkoss.util.resource.LabelLocator2
-
getCharset
public java.lang.String getCharset()
Returns "UTF-8".- Specified by:
getCharsetin interfaceorg.zkoss.util.resource.LabelLocator2
-
-