001: /*
002: * Copyright 1999-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * $Id: XMLErrorResources_it.java,v 1.5 2004/12/15 17:35:50 jycli Exp $
018: */
019: package org.apache.xml.res;
020:
021: import java.util.ListResourceBundle;
022: import java.util.Locale;
023: import java.util.MissingResourceException;
024: import java.util.ResourceBundle;
025:
026: /**
027: * Set up error messages.
028: * We build a two dimensional array of message keys and
029: * message strings. In order to add a new message here,
030: * you need to first add a String constant. And you need
031: * to enter key, value pair as part of the contents
032: * array. You also need to update MAX_CODE for error strings
033: * and MAX_WARNING for warnings ( Needed for only information
034: * purpose )
035: */
036: public class XMLErrorResources_it extends ListResourceBundle {
037:
038: /*
039: * This file contains error and warning messages related to Xalan Error
040: * Handling.
041: *
042: * General notes to translators:
043: *
044: * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of
045: * components.
046: * XSLT is an acronym for "XML Stylesheet Language: Transformations".
047: * XSLTC is an acronym for XSLT Compiler.
048: *
049: * 2) A stylesheet is a description of how to transform an input XML document
050: * into a resultant XML document (or HTML document or text). The
051: * stylesheet itself is described in the form of an XML document.
052: *
053: * 3) A template is a component of a stylesheet that is used to match a
054: * particular portion of an input document and specifies the form of the
055: * corresponding portion of the output document.
056: *
057: * 4) An element is a mark-up tag in an XML document; an attribute is a
058: * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
059: * "elem" is an element name, "attr" and "attr2" are attribute names with
060: * the values "val" and "val2", respectively.
061: *
062: * 5) A namespace declaration is a special attribute that is used to associate
063: * a prefix with a URI (the namespace). The meanings of element names and
064: * attribute names that use that prefix are defined with respect to that
065: * namespace.
066: *
067: * 6) "Translet" is an invented term that describes the class file that
068: * results from compiling an XML stylesheet into a Java class.
069: *
070: * 7) XPath is a specification that describes a notation for identifying
071: * nodes in a tree-structured representation of an XML document. An
072: * instance of that notation is referred to as an XPath expression.
073: *
074: */
075:
076: /** Maximum error messages, this is needed to keep track of the number of messages. */
077: public static final int MAX_CODE = 61;
078:
079: /** Maximum warnings, this is needed to keep track of the number of warnings. */
080: public static final int MAX_WARNING = 0;
081:
082: /** Maximum misc strings. */
083: public static final int MAX_OTHERS = 4;
084:
085: /** Maximum total warnings and error messages. */
086: public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1;
087:
088: /*
089: * Message keys
090: */
091: public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED";
092: public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE";
093: public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL";
094: public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED";
095: public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT";
096: public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL";
097: public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT";
098: public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED";
099: public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM";
100: public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS";
101: public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING";
102: public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED";
103: public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED";
104: public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED";
105: public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE";
106: public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED";
107: public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL";
108: public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED";
109: public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL";
110: public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE";
111: public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING";
112: public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER";
113: public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER";
114: public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL";
115: public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE";
116: public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED";
117: public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI";
118: public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI";
119: public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR";
120: public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING";
121: public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT";
122: public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED";
123: public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL";
124: public static final String ER_INVALID_PORT = "ER_INVALID_PORT";
125: public static final String ER_FRAG_FOR_GENERIC_URI = "ER_FRAG_FOR_GENERIC_URI";
126: public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL";
127: public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR";
128: public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE";
129: public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING";
130: public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED";
131: public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST";
132: public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST";
133: public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH";
134: public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH";
135: public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS";
136: public static final String ER_METHOD_NOT_SUPPORTED = "ER_METHOD_NOT_SUPPORTED";
137: public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE";
138: public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE";
139: public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED";
140: public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER";
141: public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN";
142: public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN";
143: public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE";
144: public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED";
145: public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT";
146: public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT";
147: public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC";
148: public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT";
149: public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL";
150: public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID";
151: public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID";
152:
153: // Message keys used by the serializer
154: public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND";
155: public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD";
156: public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO";
157: public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE";
158: public static final String ER_OIERROR = "ER_OIERROR";
159: public static final String ER_NAMESPACE_PREFIX = "ER_NAMESPACE_PREFIX";
160: public static final String ER_STRAY_ATTRIBUTE = "ER_STRAY_ATTIRBUTE";
161: public static final String ER_STRAY_NAMESPACE = "ER_STRAY_NAMESPACE";
162: public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE";
163: public static final String ER_COULD_NOT_LOAD_METHOD_PROPERTY = "ER_COULD_NOT_LOAD_METHOD_PROPERTY";
164: public static final String ER_SERIALIZER_NOT_CONTENTHANDLER = "ER_SERIALIZER_NOT_CONTENTHANDLER";
165: public static final String ER_ILLEGAL_ATTRIBUTE_POSITION = "ER_ILLEGAL_ATTRIBUTE_POSITION";
166:
167: /*
168: * Now fill in the message text.
169: * Then fill in the message text for that message code in the
170: * array. Use the new error code as the index into the array.
171: */
172:
173: // Error messages...
174: /**
175: * Get the lookup table for error messages
176: *
177: * @return The association list.
178: */
179: public Object[][] getContents() {
180: return new Object[][] {
181:
182: /** Error message ID that has a null message, but takes in a single object. */
183: { "ER0000", "{0}" },
184:
185: { ER_FUNCTION_NOT_SUPPORTED, "Funzione non supportata." },
186:
187: { ER_CANNOT_OVERWRITE_CAUSE,
188: "Impossibile sovrascrivere causa" },
189:
190: { ER_NO_DEFAULT_IMPL,
191: "Non \u00e8 stata trovata alcuna implementazione predefinita " },
192:
193: { ER_CHUNKEDINTARRAY_NOT_SUPPORTED,
194: "ChunkedIntArray({0}) correntemente non supportato" },
195:
196: { ER_OFFSET_BIGGER_THAN_SLOT,
197: "Offset pi\u00f9 grande dello slot" },
198:
199: { ER_COROUTINE_NOT_AVAIL,
200: "Coroutine non disponibile, id={0}" },
201:
202: { ER_COROUTINE_CO_EXIT,
203: "CoroutineManager ha ricevuto la richiesta co_exit()" },
204:
205: { ER_COJOINROUTINESET_FAILED,
206: "co_joinCoroutineSet() con esito negativo" },
207:
208: { ER_COROUTINE_PARAM, "Errore parametro Coroutine {0})" },
209:
210: { ER_PARSER_DOTERMINATE_ANSWERS,
211: "\nNON PREVISTO: Risposte doTerminate del parser {0}" },
212:
213: { ER_NO_PARSE_CALL_WHILE_PARSING,
214: "impossibile richiamare l'analisi durante l''analisi" },
215:
216: { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED,
217: "Errore: iteratore immesso per l''asse {0} non implementato " },
218:
219: { ER_ITERATOR_AXIS_NOT_IMPLEMENTED,
220: "Errore: iteratore per l''asse {0} non implementato " },
221:
222: { ER_ITERATOR_CLONE_NOT_SUPPORTED,
223: "Clone iteratore non supportato" },
224:
225: { ER_UNKNOWN_AXIS_TYPE,
226: "Tipo trasversale di asse sconosciuto: {0}" },
227:
228: { ER_AXIS_NOT_SUPPORTED,
229: "Trasversale dell''asse non supportato: {0}" },
230:
231: { ER_NO_DTMIDS_AVAIL,
232: "Non vi sono ulteriori ID DTM disponibili" },
233:
234: { ER_NOT_SUPPORTED, "Non supportato: {0}" },
235:
236: { ER_NODE_NON_NULL,
237: "Il nodo deve essere non nullo per getDTMHandleFromNode" },
238:
239: { ER_COULD_NOT_RESOLVE_NODE,
240: "Impossibile risolvere il nodo in un handle" },
241:
242: { ER_STARTPARSE_WHILE_PARSING,
243: "Impossibile richiamare startParse durante l'analisi" },
244:
245: { ER_STARTPARSE_NEEDS_SAXPARSER,
246: "startParse richiede SAXParser non nullo" },
247:
248: { ER_COULD_NOT_INIT_PARSER,
249: "impossibile inizializzare il parser con" },
250:
251: {
252: ER_EXCEPTION_CREATING_POOL,
253: "si \u00e8 verificata un'eccezione durante la creazione della nuova istanza per il pool" },
254:
255: { ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
256: "Il percorso contiene sequenza di escape non valida" },
257:
258: { ER_SCHEME_REQUIRED, "Lo schema \u00e8 obbligatorio." },
259:
260: { ER_NO_SCHEME_IN_URI,
261: "Nessuno schema trovato nell''URI: {0}" },
262:
263: { ER_NO_SCHEME_INURI,
264: "Non \u00e8 stato trovato alcuno schema nell'URI" },
265:
266: { ER_PATH_INVALID_CHAR,
267: "Il percorso contiene un carattere non valido: {0}" },
268:
269: { ER_SCHEME_FROM_NULL_STRING,
270: "Impossibile impostare lo schema da una stringa nulla" },
271:
272: { ER_SCHEME_NOT_CONFORMANT,
273: "Lo schema non \u00e8 conforme." },
274:
275: { ER_HOST_ADDRESS_NOT_WELLFORMED,
276: "Host non \u00e8 un'indirizzo corretto" },
277:
278: { ER_PORT_WHEN_HOST_NULL,
279: "La porta non pu\u00f2 essere impostata se l'host \u00e8 nullo" },
280:
281: { ER_INVALID_PORT, "Numero di porta non valido" },
282:
283: { ER_FRAG_FOR_GENERIC_URI,
284: "Il frammento pu\u00f2 essere impostato solo per un URI generico" },
285:
286: { ER_FRAG_WHEN_PATH_NULL,
287: "Il frammento non pu\u00f2 essere impostato se il percorso \u00e8 nullo" },
288:
289: { ER_FRAG_INVALID_CHAR,
290: "Il frammento contiene un carattere non valido" },
291:
292: { ER_PARSER_IN_USE, "Parser gi\u00e0 in utilizzo" },
293:
294: { ER_CANNOT_CHANGE_WHILE_PARSING,
295: "Impossibile modificare {0} {1} durante l''analisi" },
296:
297: { ER_SELF_CAUSATION_NOT_PERMITTED,
298: "Self-causation non consentito" },
299:
300: { ER_NO_USERINFO_IF_NO_HOST,
301: "Userinfo non pu\u00f2 essere specificato se l'host non \u00e8 specificato" },
302:
303: { ER_NO_PORT_IF_NO_HOST,
304: "La porta non pu\u00f2 essere specificata se l'host non \u00e8 specificato" },
305:
306: {
307: ER_NO_QUERY_STRING_IN_PATH,
308: "La stringa di interrogazione non pu\u00f2 essere specificata nella stringa di interrogazione e percorso." },
309:
310: {
311: ER_NO_FRAGMENT_STRING_IN_PATH,
312: "Il frammento non pu\u00f2 essere specificato sia nel percorso che nel frammento" },
313:
314: { ER_CANNOT_INIT_URI_EMPTY_PARMS,
315: "Impossibile inizializzare l'URI con i parametri vuoti" },
316:
317: { ER_METHOD_NOT_SUPPORTED,
318: "Metodo non ancora supportato " },
319:
320: { ER_INCRSAXSRCFILTER_NOT_RESTARTABLE,
321: "IncrementalSAXSource_Filter correntemente non riavviabile" },
322:
323: { ER_XMLRDR_NOT_BEFORE_STARTPARSE,
324: "XMLReader non si trova prima della richiesta startParse" },
325:
326: { ER_AXIS_TRAVERSER_NOT_SUPPORTED,
327: "Trasversale dell''asse non supportato: {0}" },
328:
329: { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER,
330: "ListingErrorHandler creato con PrintWriter nullo." },
331:
332: { ER_SYSTEMID_UNKNOWN, "SystemId sconosciuto" },
333:
334: { ER_LOCATION_UNKNOWN,
335: "Posizione di errore sconosciuta" },
336:
337: { ER_PREFIX_MUST_RESOLVE,
338: "Il prefisso deve risolvere in uno spazio nomi: {0}" },
339:
340: { ER_CREATEDOCUMENT_NOT_SUPPORTED,
341: "createDocument() non supportato in XPathContext!" },
342:
343: { ER_CHILD_HAS_NO_OWNER_DOCUMENT,
344: "Il secondario dell'attributo non ha un documento proprietario." },
345:
346: { ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT,
347: "Il secondario dell'attributo non ha un elemento del documento proprietario." },
348:
349: {
350: ER_CANT_OUTPUT_TEXT_BEFORE_DOC,
351: "Attenzione: impossibile emettere testo prima dell'elemento del documento. Operazione ignorata..." },
352:
353: { ER_CANT_HAVE_MORE_THAN_ONE_ROOT,
354: "Impossibile avere pi\u00f9 di una root in un DOM!" },
355:
356: { ER_ARG_LOCALNAME_NULL, "Argomento 'localName' nullo" },
357:
358: // Note to translators: A QNAME has the syntactic form [NCName:]NCName
359: // The localname is the portion after the optional colon; the message indicates
360: // that there is a problem with that part of the QNAME.
361: { ER_ARG_LOCALNAME_INVALID,
362: "Localname in QNAME deve essere un NCName valido " },
363:
364: // Note to translators: A QNAME has the syntactic form [NCName:]NCName
365: // The prefix is the portion before the optional colon; the message indicates
366: // that there is a problem with that part of the QNAME.
367: { ER_ARG_PREFIX_INVALID,
368: "Prefix in QNAME deve essere un NCName valido " },
369:
370: { "BAD_CODE",
371: "Il parametro per createMessage fuori limite" },
372: { "FORMAT_FAILED",
373: "Rilevata eccezione durante la chiamata messageFormat" },
374: { "line", "Riga #" },
375: { "column", "Colonna #" },
376:
377: { ER_SERIALIZER_NOT_CONTENTHANDLER,
378: "La classe serializer ''{0}'' non implementa org.xml.sax.ContentHandler." },
379:
380: { ER_RESOURCE_COULD_NOT_FIND,
381: "Risorsa [ {0} ] non trovata.\n {1}" },
382:
383: { ER_RESOURCE_COULD_NOT_LOAD,
384: "Impossibile caricare la risorsa [ {0} ]: {1} \n {2} \t {3}" },
385:
386: { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Dimensione buffer <=0" },
387:
388: { ER_INVALID_UTF16_SURROGATE,
389: "Rilevato surrogato UTF-16 non valido: {0} ?" },
390:
391: { ER_OIERROR, "Errore IO" },
392:
393: {
394: ER_ILLEGAL_ATTRIBUTE_POSITION,
395: "Impossibile aggiungere l''attributo {0} dopo i nodi secondari o prima che sia prodotto un elemento. L''attributo verr\u00e0 ignorato. " },
396:
397: /*
398: * Note to translators: The stylesheet contained a reference to a
399: * namespace prefix that was undefined. The value of the substitution
400: * text is the name of the prefix.
401: */
402: { ER_NAMESPACE_PREFIX,
403: "Lo spazio nomi per il prefisso ''{0}'' non \u00e8 stato dichiarato. " },
404: /*
405: * Note to translators: This message is reported if the stylesheet
406: * being processed attempted to construct an XML document with an
407: * attribute in a place other than on an element. The substitution text
408: * specifies the name of the attribute.
409: */
410: { ER_STRAY_ATTRIBUTE,
411: "Attributo ''{0}'' al di fuori dell''elemento. " },
412:
413: /*
414: * Note to translators: As with the preceding message, a namespace
415: * declaration has the form of an attribute and is only permitted to
416: * appear on an element. The substitution text {0} is the namespace
417: * prefix and {1} is the URI that was being used in the erroneous
418: * namespace declaration.
419: */
420: { ER_STRAY_NAMESPACE,
421: "Dichiarazione dello spazio nome ''{0}''=''{1}'' al di fuori dell''elemento. " },
422:
423: {
424: ER_COULD_NOT_LOAD_RESOURCE,
425: "Impossibile caricare ''{0}'' (verificare CLASSPATH); verranno utilizzati i valori predefiniti " },
426:
427: {
428: ER_COULD_NOT_LOAD_METHOD_PROPERTY,
429: "Impossibile caricare il file delle propriet\u00e0 ''{0}'' per il metodo di emissione ''{1}'' (verificare CLASSPATH)" }
430:
431: };
432: }
433:
434: /**
435: * Return a named ResourceBundle for a particular locale. This method mimics the behavior
436: * of ResourceBundle.getBundle().
437: *
438: * @param className the name of the class that implements the resource bundle.
439: * @return the ResourceBundle
440: * @throws MissingResourceException
441: */
442: public static final XMLErrorResources loadResourceBundle(
443: String className) throws MissingResourceException {
444:
445: Locale locale = Locale.getDefault();
446: String suffix = getResourceSuffix(locale);
447:
448: try {
449:
450: // first try with the given locale
451: return (XMLErrorResources) ResourceBundle.getBundle(
452: className + suffix, locale);
453: } catch (MissingResourceException e) {
454: try // try to fall back to en_US if we can't load
455: {
456:
457: // Since we can't find the localized property file,
458: // fall back to en_US.
459: return (XMLErrorResources) ResourceBundle.getBundle(
460: className, new Locale("it", "IT"));
461: } catch (MissingResourceException e2) {
462:
463: // Now we are really in trouble.
464: // very bad, definitely very bad...not going to get very far
465: throw new MissingResourceException(
466: "Could not load any resource bundles.",
467: className, "");
468: }
469: }
470: }
471:
472: /**
473: * Return the resource file suffic for the indicated locale
474: * For most locales, this will be based the language code. However
475: * for Chinese, we do distinguish between Taiwan and PRC
476: *
477: * @param locale the locale
478: * @return an String suffix which canbe appended to a resource name
479: */
480: private static final String getResourceSuffix(Locale locale) {
481:
482: String suffix = "_" + locale.getLanguage();
483: String country = locale.getCountry();
484:
485: if (country.equals("TW"))
486: suffix += "_" + country;
487:
488: return suffix;
489: }
490:
491: }
|