1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.myfaces.trinidad.context;
20
21 import java.util.Locale;
22 import java.util.MissingResourceException;
23 import java.util.ResourceBundle;
24 import java.util.TimeZone;
25
26 /**
27 * Context for locale-specific operations and properties available
28 * during rendering.
29 *
30 * @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/nls/LocaleContext.java#0 $) $Date: 10-nov-2005.19:00:03 $
31 */
32 abstract public class LocaleContext
33 {
34 protected LocaleContext()
35 {
36 }
37
38 /**
39 * Returns the locale that should be used for formatting.
40 */
41 abstract public Locale getFormattingLocale();
42
43 /**
44 * Returns the formatting Locale in IANA String format.
45 */
46 abstract public String getFormattingIANALocaleString();
47
48
49 /**
50 * Returns the locale that should be used for formatting.
51 * @deprecated use getFormattingLocale()
52 */
53 @Deprecated
54 public Locale getLocale()
55 {
56 return getFormattingLocale();
57 }
58
59 /**
60 * Returns the Locale in IANA String format.
61 * @deprecated use getFormattingIANALocaleString()
62 */
63 @Deprecated
64 public String getIANALocaleString()
65 {
66 return getFormattingIANALocaleString();
67 }
68
69
70
71 /**
72 * Returns the locale that should be used for translations..
73 */
74 abstract public Locale getTranslationLocale();
75
76
77 /**
78 * Returns the translation Locale in IANA String format.
79 */
80 abstract public String getTranslationIANALocaleString();
81
82 abstract public boolean isRightToLeft();
83
84 /**
85 * Returns the TimeZone of the application, as specified in
86 * trinidad-config.xml. If unspecified, defaults to the server timezone.
87 */
88 abstract public TimeZone getTimeZone();
89
90 /**
91 * Returns the resource bundle with the specified name, for this
92 * <strong>translation</strong> locale.
93 * <p>
94 * As the LocaleContext maintains a cache of found ResourceBundles,
95 * this is much faster than using
96 * <code>ResourceBundle.getBundle</code>
97 * <p>
98 * @see java.util.ResourceBundle#getBundle
99 */
100 abstract public ResourceBundle getBundle(
101 String baseBundleName) throws MissingResourceException;
102
103 /**
104 * Returns the year offset for parsing years with only two digits.
105 */
106 public abstract int getTwoDigitYearStart();
107
108 /**
109 * Returns the character used to separate number groups.
110 * If zero (NUL), the default separator for the Locale
111 * will be used.
112 */
113 public abstract char getGroupingSeparator();
114
115 /**
116 * Returns the character used as a decimal separator.
117 * If zero (NUL), the default separator for the Locale
118 * will be used.
119 */
120 public abstract char getDecimalSeparator();
121 }