svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.i18n / src / main / java / org / gvsig / i18n / tools / impl / DefaultI18Manager.java @ 42761
History | View | Annotate | Download (2.2 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.i18n.tools.impl; |
25 |
|
26 |
import java.io.File; |
27 |
import java.net.MalformedURLException; |
28 |
import java.util.Locale; |
29 |
import java.util.logging.Level; |
30 |
import java.util.logging.Logger; |
31 |
|
32 |
import org.gvsig.i18n.Messages; |
33 |
import org.gvsig.tools.i18n.I18nManager; |
34 |
|
35 |
/**
|
36 |
* This manager is in charge of providing with a richer text translation than
|
37 |
* the one used by default.
|
38 |
*
|
39 |
*
|
40 |
* @author gvSIG Team
|
41 |
*
|
42 |
*/
|
43 |
public class DefaultI18Manager implements I18nManager { |
44 |
|
45 |
public String getTranslation(String message) { |
46 |
return Messages.getText(message);
|
47 |
} |
48 |
|
49 |
public String getTranslation(String message, String[] args) { |
50 |
return Messages.getText(message,args);
|
51 |
} |
52 |
|
53 |
public void addResourceFamily(String family, ClassLoader loader, |
54 |
String callerName) {
|
55 |
if (!Messages.hasLocales()) {
|
56 |
Messages.addLocale(Locale.getDefault());
|
57 |
} |
58 |
Messages.addResourceFamily(family, loader, callerName); |
59 |
} |
60 |
|
61 |
public void addResourceFamily(String family, File folder) { |
62 |
if (!Messages.hasLocales()) {
|
63 |
Messages.addLocale(Locale.getDefault());
|
64 |
} |
65 |
try {
|
66 |
Messages.addResourceFamily(family, folder); |
67 |
} catch (MalformedURLException ex) { |
68 |
throw new RuntimeException(ex); |
69 |
} |
70 |
} |
71 |
} |