From d21bf569ae32f522e1014b8c0087a76e87be92e5 Mon Sep 17 00:00:00 2001 From: Diego Pino Garcia Date: Thu, 12 Nov 2009 17:54:51 +0100 Subject: [PATCH] ItEr34S15ArquitecturaServidorItEr33S13: Added gettext-commons dependency in navalplanner-business --- navalplanner-business/pom.xml | 7 +- .../business/i18n/I18nHelper.java | 72 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 navalplanner-business/src/main/java/org/navalplanner/business/i18n/I18nHelper.java diff --git a/navalplanner-business/pom.xml b/navalplanner-business/pom.xml index e6e0a400b..f1517225f 100644 --- a/navalplanner-business/pom.xml +++ b/navalplanner-business/pom.xml @@ -12,6 +12,11 @@ Naval Planner Business Module + + + org.xnap.commons + gettext-commons + ${jdbcDriver.groupId} @@ -85,4 +90,4 @@ slf4j-simple - \ No newline at end of file + diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/i18n/I18nHelper.java b/navalplanner-business/src/main/java/org/navalplanner/business/i18n/I18nHelper.java new file mode 100644 index 000000000..df5f088b6 --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/i18n/I18nHelper.java @@ -0,0 +1,72 @@ +/* + * This file is part of ###PROJECT_NAME### + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.business.i18n; + +import java.util.HashMap; +import java.util.Locale; + +import com.sun.org.apache.xml.internal.security.utils.I18n; + +public class I18nHelper { + +// private I18nHelper() { +// } +// +// private static HashMap localesCache = new HashMap(); +// +// public static I18n getI18n() { +// if (localesCache.keySet().contains(Locales.getCurrent())) { +// return localesCache.get(Locales.getCurrent()); +// } +// +// I18n i18n = I18nFactory.getI18n(I18nHelper.class, Locales +// .getCurrent(), +// org.xnap.commons.i18n.I18nFactory.FALLBACK); +// localesCache.put(Locales.getCurrent(), i18n); +// +// return i18n; +// } +// +// public static String _(String text) { +// return getI18n().tr(text); +// } +// +// public static String _(String text, Object o1) { +// return getI18n().tr(text, o1); +// } +// +// public static String _(String text, Object o1, Object o2) { +// return getI18n().tr(text, o1, o2); +// } +// +// public static String _(String text, Object o1, Object o2, Object o3) { +// return getI18n().tr(text, o1, o2, o3); +// } +// +// public static String _(String text, Object o1, Object o2, Object o3, +// Object o4) { +// return getI18n().tr(text, o1, o2, o3, o4); +// } +// +// public static String _(String text, Object[] objects) { +// return getI18n().tr(text, objects); +// } +}