root / org.gvsig.projection / trunk / src / main / java / org / cresques / Messages.java @ 84
History | View | Annotate | Download (2.24 KB)
1 |
/* Cresques Mapping Suite. Graphic Library for constructing mapping applications.
|
---|---|
2 |
* Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or
|
5 |
* modify it under the terms of the GNU General Public License
|
6 |
* as published by the Free Software Foundation; either version 2
|
7 |
* of the License, or (at your option) any later version.
|
8 |
*
|
9 |
* This program is distributed in the hope that it will be useful,
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
* GNU General Public License for more details.
|
13 |
*
|
14 |
* You should have received a copy of the GNU General Public License
|
15 |
* along with this program; if not, write to the Free Software
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
17 |
*
|
18 |
* For more information, contact:
|
19 |
*
|
20 |
* Generalitat Valenciana
|
21 |
* Conselleria d'Infraestructures i Transport
|
22 |
* Av. Blasco Ib??ez, 50
|
23 |
* 46010 VALENCIA
|
24 |
* SPAIN
|
25 |
*
|
26 |
* +34 963862235
|
27 |
* gvsig@gva.es
|
28 |
* www.gvsig.gva.es
|
29 |
*
|
30 |
* or
|
31 |
*
|
32 |
* IVER T.I. S.A
|
33 |
* Salamanca 50
|
34 |
* 46005 Valencia
|
35 |
* Spain
|
36 |
*
|
37 |
* +34 963163400
|
38 |
* dac@iver.es
|
39 |
*/
|
40 |
|
41 |
|
42 |
package org.cresques; |
43 |
|
44 |
import java.util.Locale; |
45 |
|
46 |
import org.gvsig.tools.ToolsLocator; |
47 |
import org.gvsig.tools.i18n.I18nManager; |
48 |
|
49 |
/**
|
50 |
* Bridge class to provide internationalization services to the library.
|
51 |
* It uses the gvsig-i18n library as a backend, and includes its
|
52 |
* necessary initialization.
|
53 |
*
|
54 |
* @author Cesar Martinez Izquierdo
|
55 |
*
|
56 |
*/
|
57 |
public class Messages { |
58 |
private static I18nManager manager = null; |
59 |
/**
|
60 |
* Loads the translations in the dictionary. It initializes the backend
|
61 |
* gvsig-i18n library
|
62 |
*
|
63 |
*/
|
64 |
private static void init() { |
65 |
I18nManager manager = ToolsLocator.getI18nManager(); |
66 |
manager.addResourceFamily("org.cresques.resources.i18n.text", Messages.class.getClassLoader(), Messages.class.getClass().getName());
|
67 |
} |
68 |
|
69 |
/**
|
70 |
* Gets the translation associated with the provided translation key.
|
71 |
*
|
72 |
* @param key The translation key which identifies the target text
|
73 |
* @return The translation associated with the provided translation key.
|
74 |
*/
|
75 |
public static String getText(String key) { |
76 |
if (manager == null ) { |
77 |
init(); |
78 |
} |
79 |
return manager.getTranslation(key);
|
80 |
} |
81 |
|
82 |
} |
83 |
|