Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / extI18n / src / main / java / org / gvsig / i18n / I18nManager.java @ 38564

History | View | Annotate | Download (7.58 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 {DiSiD Technologies}  {New extension for installation and update of text translations}
26
 */
27
package org.gvsig.i18n;
28

    
29
import java.io.File;
30
import java.util.Locale;
31

    
32
/**
33
 * Management of I18n and Locale related activities.
34
 * 
35
 * @author <a href="mailto:dcervera@disid.com">David Cervera</a>
36
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
37
 */
38
public interface I18nManager {
39

    
40
    public static final Locale SPANISH = new Locale("es");
41

    
42
    public static final Locale ENGLISH = new Locale("en");
43

    
44
    /**
45
     * Returns the display name of a locale language.
46
     * 
47
     * @param locale
48
     *            to get the language display name
49
     * @param displayLocale
50
     *            the locale to display the name
51
     * @return the locale language display name
52
     */
53
    String getLanguageDisplayName(Locale locale, Locale displayLocale);
54

    
55
    /**
56
     * Returns the display name of a locale language.
57
     * 
58
     * @param locale
59
     *            to get the language display name
60
     * @return the locale language display name
61
     */
62
    String getLanguageDisplayName(Locale locale);
63

    
64
    /**
65
     * Returns the display name of a locale in the given locale to be displayed.
66
     * 
67
     * @param locale
68
     *            to get the display name
69
     * @param displayLocale
70
     *            the locale to display the name
71
     * @return the locale display name
72
     */
73
    String getDisplayName(Locale locale, Locale displayLocale);
74

    
75
    /**
76
     * Returns the display name of a locale.
77
     * 
78
     * @param locale
79
     *            to get the display name
80
     * @return the locale display name
81
     */
82
    String getDisplayName(Locale locale);
83

    
84
    /**
85
     * Returns the current locale.
86
     * 
87
     * @return the current locale
88
     */
89
    Locale getCurrentLocale();
90

    
91
    /**
92
     * Sets the current application locale.
93
     * 
94
     * @param locale
95
     *            the current application locale
96
     */
97
    void setCurrentLocale(Locale locale);
98
    
99
    /**
100
     * Returns the application host system default locale.
101
     * 
102
     * @return the default system locale
103
     */
104
    Locale getDefaultSystemLocale();
105

    
106
    /**
107
     * Returns the list of locales supported by the current gvSIG installation.
108
     * 
109
     * @return the list of locales supported
110
     */
111
    Locale[] getInstalledLocales();
112

    
113
    /**
114
     * Installs or a new locale (or a list) and its translation, or updates an
115
     * already existing one.
116
     * 
117
     * @param importFile
118
     *            the jar or zip file which contains the locales and the
119
     *            translations as resource bundle files
120
     * @return the list of installed or updated locales
121
     * @throws I18nException
122
     *             if the locales could'n be installed
123
     */
124
    Locale[] installLocales(File importFile) throws I18nException;
125

    
126
    /**
127
     * Uninstalls a locale and its translation.
128
     * 
129
     * @param locale
130
     *            to uninstall
131
     * @throws I18nException
132
     *             if the locale can't be uninstalled
133
     */
134
    void uninstallLocale(Locale locale) throws I18nException;
135

    
136
    /**
137
     * Exports the translations of a locale to update or complete its
138
     * translation, into a jar file. Into the file is also included the
139
     * translations of another existing locale to be used as reference for
140
     * updating the locale.
141
     * 
142
     * @param locale
143
     *            the locale to update or complete
144
     * @param referenceLocale
145
     *            the locale to be used as reference
146
     * @param exportFile
147
     *            the jar file to export to
148
     * @throws I18nException
149
     *             if the locale could not be exported for update
150
     */
151
    void exportLocaleForUpdate(Locale locale, Locale referenceLocale,
152
            File exportFile) throws I18nException;
153

    
154
    /**
155
     * Exports the translations of a list of locales to update or complete its
156
     * translation, into a jar file. Into the file is also included the
157
     * translations of another existing locale to be used as reference for
158
     * updating the locale.
159
     * 
160
     * @param locales
161
     *            the locales to update or complete
162
     * @param referenceLocale
163
     *            the locale to be used as reference
164
     * @param exportFile
165
     *            the jar file to export to
166
     * @throws I18nException
167
     *             if the locale could not be exported for update
168
     */
169
    void exportLocalesForUpdate(Locale[] locales, Locale referenceLocale,
170
            File exportFile) throws I18nException;
171

    
172
    /**
173
     * Exports the keys of text to translate to a new locale to a jar file. Into
174
     * the file is also included the translations of another existing locale to
175
     * be used as reference for translating to the new locale.
176
     * 
177
     * @param locale
178
     *            the new locale to translate to
179
     * @param referenceLocale
180
     *            the locale to be used as reference
181
     * @param exportFile
182
     *            the jar file to export to
183
     * @throws I18nException
184
     *             if the locale could not be exported for translation
185
     */
186
    void exportLocaleForTranslation(Locale locale, Locale referenceLocale,
187
            File exportFile) throws I18nException;
188

    
189
    /**
190
     * Exports the keys of text to translate to a new locale to a jar file. Into
191
     * the file is also included the translations of another existing locales to
192
     * be used as reference for translating to the new locale.
193
     * 
194
     * @param locale
195
     *            the new locale to translate to
196
     * @param referenceLocales
197
     *            the locales to be used as reference
198
     * @param exportFile
199
     *            the jar file to export to
200
     * @throws I18nException
201
     *             if the locale could not be exported for translation
202
     */
203
    void exportLocaleForTranslation(Locale locale, Locale[] referenceLocales,
204
            File exportFile) throws I18nException;
205

    
206
    /**
207
     * Returns the list of default locales to use as reference when exporting to
208
     * translate a new locale, or update or complete an existing one.
209
     * 
210
     * @return the list of default locales to export
211
     */
212
    Locale[] getReferenceLocales();
213

    
214
    /**
215
     * Sets the list of default locales to export.
216
     * 
217
     * @param referenceLocales
218
     *            the list of default locales to export
219
     */
220
    void setReferenceLocales(Locale[] referenceLocales);
221

    
222
    /**
223
     * Sets the list of default locales bundled with gvSIG. That list of locales
224
     * will be used as the list of installed ones when gvSIG is run for the
225
     * first time with the I18n extension. The following times, that list will
226
     * be taken form the extension configuration in the plugins persistence.
227
     * 
228
     * @param defaultLocales
229
     */
230
    void setDefaultLocales(Locale[] defaultLocales);
231
}