Source Code Cross Referenced for XResourceBundle.java in  » XML » xalan » org » apache » xml » utils » res » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » xalan » org.apache.xml.utils.res 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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: XResourceBundle.java,v 1.8 2004/12/15 17:35:52 jycli Exp $
018:         */
019:        package org.apache.xml.utils.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:         * The default (english) resource bundle.
028:         * @xsl.usage internal
029:         */
030:        public class XResourceBundle extends ListResourceBundle {
031:
032:            /** Error resource constants */
033:            public static final String ERROR_RESOURCES = "org.apache.xalan.res.XSLTErrorResources",
034:                    XSLT_RESOURCE = "org.apache.xml.utils.res.XResourceBundle",
035:                    LANG_BUNDLE_NAME = "org.apache.xml.utils.res.XResources",
036:                    MULT_ORDER = "multiplierOrder",
037:                    MULT_PRECEDES = "precedes",
038:                    MULT_FOLLOWS = "follows",
039:                    LANG_ORIENTATION = "orientation",
040:                    LANG_RIGHTTOLEFT = "rightToLeft",
041:                    LANG_LEFTTORIGHT = "leftToRight",
042:                    LANG_NUMBERING = "numbering",
043:                    LANG_ADDITIVE = "additive",
044:                    LANG_MULT_ADD = "multiplicative-additive",
045:                    LANG_MULTIPLIER = "multiplier",
046:                    LANG_MULTIPLIER_CHAR = "multiplierChar",
047:                    LANG_NUMBERGROUPS = "numberGroups",
048:                    LANG_NUM_TABLES = "tables",
049:                    LANG_ALPHABET = "alphabet",
050:                    LANG_TRAD_ALPHABET = "tradAlphabet";
051:
052:            /**
053:             * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
054:             * of ResourceBundle.getBundle().
055:             *
056:             * @param className Name of local-specific subclass.
057:             * @param locale the locale to prefer when searching for the bundle
058:             */
059:            public static final XResourceBundle loadResourceBundle(
060:                    String className, Locale locale)
061:                    throws MissingResourceException {
062:
063:                String suffix = getResourceSuffix(locale);
064:
065:                //System.out.println("resource " + className + suffix);
066:                try {
067:
068:                    // first try with the given locale
069:                    String resourceName = className + suffix;
070:                    return (XResourceBundle) ResourceBundle.getBundle(
071:                            resourceName, locale);
072:                } catch (MissingResourceException e) {
073:                    try // try to fall back to en_US if we can't load
074:                    {
075:
076:                        // Since we can't find the localized property file,
077:                        // fall back to en_US.
078:                        return (XResourceBundle) ResourceBundle.getBundle(
079:                                XSLT_RESOURCE, new Locale("en", "US"));
080:                    } catch (MissingResourceException e2) {
081:
082:                        // Now we are really in trouble.
083:                        // very bad, definitely very bad...not going to get very far
084:                        throw new MissingResourceException(
085:                                "Could not load any resource bundles.",
086:                                className, "");
087:                    }
088:                }
089:            }
090:
091:            /**
092:             * Return the resource file suffic for the indicated locale
093:             * For most locales, this will be based the language code.  However
094:             * for Chinese, we do distinguish between Taiwan and PRC
095:             *
096:             * @param locale the locale
097:             * @return an String suffix which canbe appended to a resource name
098:             */
099:            private static final String getResourceSuffix(Locale locale) {
100:
101:                String lang = locale.getLanguage();
102:                String country = locale.getCountry();
103:                String variant = locale.getVariant();
104:                String suffix = "_" + locale.getLanguage();
105:
106:                if (lang.equals("zh"))
107:                    suffix += "_" + country;
108:
109:                if (country.equals("JP"))
110:                    suffix += "_" + country + "_" + variant;
111:
112:                return suffix;
113:            }
114:
115:            /**
116:             * Get the association list.
117:             *
118:             * @return The association list.
119:             */
120:            public Object[][] getContents() {
121:                return new Object[][] {
122:                        { "ui_language", "en" },
123:                        { "help_language", "en" },
124:                        { "language", "en" },
125:                        {
126:                                "alphabet",
127:                                new CharArrayWrapper(
128:                                        new char[] { 'A', 'B', 'C', 'D', 'E',
129:                                                'F', 'G', 'H', 'I', 'J', 'K',
130:                                                'L', 'M', 'N', 'O', 'P', 'Q',
131:                                                'R', 'S', 'T', 'U', 'V', 'W',
132:                                                'X', 'Y', 'Z' }) },
133:                        {
134:                                "tradAlphabet",
135:                                new CharArrayWrapper(
136:                                        new char[] { 'A', 'B', 'C', 'D', 'E',
137:                                                'F', 'G', 'H', 'I', 'J', 'K',
138:                                                'L', 'M', 'N', 'O', 'P', 'Q',
139:                                                'R', 'S', 'T', 'U', 'V', 'W',
140:                                                'X', 'Y', 'Z' }) },
141:
142:                        //language orientation
143:                        { "orientation", "LeftToRight" },
144:
145:                        //language numbering   
146:                        { "numbering", "additive" }, };
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.