[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Tue Jul 10 06:23:20 EDT 2007
User: gavin
Date: 07/07/10 06:23:20
Modified: src/main/org/jboss/seam/core Interpolator.java
ResourceBundle.java
Added: src/main/org/jboss/seam/core Locale.java
Log:
move Locale back to core
Revision Changes Path
1.25 +0 -1 jboss-seam/src/main/org/jboss/seam/core/Interpolator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Interpolator.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Interpolator.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- Interpolator.java 20 Jun 2007 17:45:55 -0000 1.24
+++ Interpolator.java 10 Jul 2007 10:23:20 -0000 1.25
@@ -13,7 +13,6 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.international.Locale;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
1.36 +2 -9 jboss-seam/src/main/org/jboss/seam/core/ResourceBundle.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ResourceBundle.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/ResourceBundle.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- ResourceBundle.java 10 Jul 2007 08:57:36 -0000 1.35
+++ ResourceBundle.java 10 Jul 2007 10:23:20 -0000 1.36
@@ -7,7 +7,6 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
-import java.util.Locale;
import java.util.MissingResourceException;
import org.jboss.seam.Component;
@@ -44,12 +43,6 @@
private String[] bundleNames = {"messages"};
- protected java.util.Locale getCurrentLocale()
- {
- //TODO:
- return Locale.getDefault();
- }
-
public class UberResourceBundle extends java.util.ResourceBundle
{
private final List<java.util.ResourceBundle> bundles;
@@ -62,7 +55,7 @@
@Override
public java.util.Locale getLocale()
{
- return getCurrentLocale();
+ return org.jboss.seam.core.Locale.instance();
}
@Override
@@ -166,7 +159,7 @@
{
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle(
bundleName,
- getCurrentLocale(),
+ org.jboss.seam.core.Locale.instance(),
Thread.currentThread().getContextClassLoader()
);
log.debug("loaded resource bundle: " + bundleName);
1.8 +14 -9 jboss-seam/src/main/org/jboss/seam/core/Locale.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Locale.java
===================================================================
RCS file: Locale.java
diff -N Locale.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Locale.java 10 Jul 2007 10:23:20 -0000 1.8
@@ -0,0 +1,45 @@
+package org.jboss.seam.core;
+
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+
+/**
+ * Manager component for the current locale. This base
+ * implementation simply returns the server default
+ * locale.
+ *
+ * @author Gavin King
+ */
+ at Scope(ScopeType.STATELESS)
+ at Name("org.jboss.seam.core.locale")
+ at Install(precedence=BUILT_IN)
+ at BypassInterceptors
+public class Locale
+{
+
+ @Unwrap
+ public java.util.Locale getLocale()
+ {
+ return java.util.Locale.getDefault();
+ }
+
+ public static java.util.Locale instance()
+ {
+ if ( Contexts.isApplicationContextActive() )
+ {
+ return (java.util.Locale) Component.getInstance(Locale.class, ScopeType.STATELESS);
+ }
+ else
+ {
+ return java.util.Locale.getDefault(); //for unit tests
+ }
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list