Develop and Download Open Source Software

Browse CVS Repository

Contents of /pal/libraries/faces-utils/src/main/java/jp/sf/pal/common/faces/util/LocaleUtil.java

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Thu Jan 25 22:41:49 2007 UTC (17 years, 1 month ago) by shinsuke
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-java
added faces-util library

1 /*
2 * Copyright 2004-2007 The Portal Application Laboratory Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package jp.sf.pal.common.faces.util;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20
21 import java.util.Locale;
22
23 import javax.faces.context.FacesContext;
24
25 public class LocaleUtil {
26 /**
27 * Logger for this class
28 */
29 private static final Log log = LogFactory.getLog(LocaleUtil.class);
30
31 public static Locale getLocale() {
32 try {
33 return FacesContext.getCurrentInstance().getViewRoot().getLocale();
34 } catch (RuntimeException e) {
35 log
36 .error("FacesContext.getCurrentInstance().getViewRoot().getLocale() is invalid state.");
37 return Locale.ENGLISH;
38 }
39 }
40 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26