Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.i18n.app / org.gvsig.i18n.app.mainplugin / src / main / java / org / gvsig / i18n / I18nManager.java @ 40557

History | View | Annotate | Download (7.62 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
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2008 {DiSiD Technologies}  {New extension for installation and update of text translations}
27
 */
28
package org.gvsig.i18n;
29

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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