git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@31363 d1611594-4594-4d17-8e1d-87c2c4800839
parent
c5d5f91812
commit
adc8def6d4
|
@ -13,46 +13,54 @@ import javax.servlet.ServletContext;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author gleimar
|
* @author gleimar
|
||||||
*/
|
*/
|
||||||
public class MyLabelLocatorGeneral implements org.zkoss.util.resource.LabelLocator {
|
public class MyLabelLocatorGeneral implements org.zkoss.util.resource.LabelLocator {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(MyLabelLocatorGeneral.class);
|
private static Logger log = Logger.getLogger(MyLabelLocatorGeneral.class);
|
||||||
private ServletContext _svlctx;
|
private ServletContext _svlctx;
|
||||||
|
private static final Locale localeEspanhol = new Locale("es");
|
||||||
|
|
||||||
public MyLabelLocatorGeneral(ServletContext svlctx) {
|
public MyLabelLocatorGeneral(ServletContext svlctx) {
|
||||||
if (svlctx == null) {
|
if (svlctx == null) {
|
||||||
throw new IllegalArgumentException("null");
|
throw new IllegalArgumentException("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
_svlctx = svlctx;
|
_svlctx = svlctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
public URL locate(Locale locale) {
|
public URL locate(Locale locale) {
|
||||||
URL resource = null;
|
URL resource = null;
|
||||||
try {
|
try {
|
||||||
resource =_svlctx.getResource("/WEB-INF/" + getI3LabelName(locale));
|
resource = _svlctx.getResource("/WEB-INF/" + getI3LabelName(locale));
|
||||||
if (resource == null){
|
if (resource == null) {
|
||||||
resource= _svlctx.getResource("/WEB-INF/" + getI3LabelDefault());
|
resource = _svlctx.getResource("/WEB-INF/" + getI3LabelDefault());
|
||||||
}
|
}
|
||||||
} catch (MalformedURLException ex) {
|
} catch (MalformedURLException ex) {
|
||||||
log.error("Error al cargar locale:"+locale,ex);
|
log.error("Error al cargar locale:" + locale, ex);
|
||||||
try {
|
try {
|
||||||
resource= _svlctx.getResource("/WEB-INF/" + getI3LabelDefault());
|
resource = _svlctx.getResource("/WEB-INF/" + getI3LabelDefault());
|
||||||
} catch (MalformedURLException ex1) {
|
} catch (MalformedURLException ex1) {
|
||||||
log.error("Error al cargar la traduccion estandard.",ex1);
|
log.error("Error al cargar la traduccion estandard.", ex1);
|
||||||
throw new RuntimeException(ex1);
|
throw new RuntimeException(ex1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resource;
|
return resource;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String getI3LabelName(Locale locale) {
|
||||||
|
|
||||||
|
if ((locale != null) && (locale.getLanguage().equals(localeEspanhol.getLanguage()))) {
|
||||||
|
return "i3-label_es_MX.label";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "i3-label_" + locale + ".label";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String getI3LabelDefault() {
|
||||||
|
return "i3-label_pt_BR.label";
|
||||||
|
}
|
||||||
|
|
||||||
private static final String getI3LabelName(Locale locale) {
|
|
||||||
return "i3-label_" + locale + ".label";
|
|
||||||
}
|
|
||||||
private static final String getI3LabelDefault() {
|
|
||||||
return "i3-label_pt_BR.label";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
ADM_20131002_1RC244
|
ADM_20131003_1RC245
|
||||||
|
|
Loading…
Reference in New Issue