diff --git a/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/css/styles.css b/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/css/styles.css
new file mode 100644
index 0000000..7f6e3fa
--- /dev/null
+++ b/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/css/styles.css
@@ -0,0 +1,19 @@
+@CHARSET "UTF-8";
+
+.ui-icon-locale-pt
+ ,.ui-icon-locale-en{
+ width: 32px;
+ height: 31px;
+ background-position: center;
+ display: block;
+ float: left;
+ background-repeat: no-repeat;
+}
+
+.ui-icon-locale-pt{
+ background-image: url("../images/locale_pt.png");
+}
+
+.ui-icon-locale-en{
+ background-image: url("../images/locale_en.png");
+}
\ No newline at end of file
diff --git a/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/images/locale_en.png b/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/images/locale_en.png
new file mode 100644
index 0000000..ba7dbed
Binary files /dev/null and b/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/images/locale_en.png differ
diff --git a/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/images/locale_pt.png b/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/images/locale_pt.png
new file mode 100644
index 0000000..4521af9
Binary files /dev/null and b/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/images/locale_pt.png differ
diff --git a/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/template/main.xhtml b/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/template/main.xhtml
index b7d1818..37c5fa1 100644
--- a/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/template/main.xhtml
+++ b/archetype/jsf-jpa/src/main/resources/archetype-resources/src/main/webapp/template/main.xhtml
@@ -1,7 +1,7 @@
-
+
#{messages['main.app.title']}
@@ -11,7 +11,19 @@
-  |
+
+
+
+
+
+
+
+
+
+
+
+
+ |
|
diff --git a/impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Locales.java b/impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Locales.java
index 58634ef..ee353ba 100644
--- a/impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Locales.java
+++ b/impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Locales.java
@@ -67,20 +67,20 @@ public class Locales implements Serializable {
* Set the language to "en_US". This is a shorthand to setLocale(Locale.US).
*/
public void setEnglish() {
- setLocale(Locale.US);
+ setCurrentLocale(Locale.US);
}
/**
* Set the language to "pt_BR". This is a shorthand to setLocale(Locales.PT_BR).
*/
public void setPortuguese() {
- setLocale(PT_BR);
+ setCurrentLocale(PT_BR);
}
/**
* @return The current locale, or {@link Locale#getDefault()} if one has not been set.
*/
- public Locale getLocale(){
+ public Locale getCurrentLocale(){
return this.locale!=null ? this.locale : Locale.getDefault();
}
@@ -89,7 +89,7 @@ public class Locales implements Serializable {
*
* @param locale The new locale
*/
- public void setLocale(Locale locale) {
+ public void setCurrentLocale(Locale locale) {
Iterator supportedLocales = getContext().getApplication().getSupportedLocales();
if (supportedLocales==null){
this.locale = locale;
@@ -114,6 +114,18 @@ public class Locales implements Serializable {
}
/**
+ * Set the locale for the current view. The language will be parsed
+ * into an instance of {@link Locale} and then {@link #setLocale(Locale locale)} will
+ * be called using the parsed language.
+ *
+ * @param language String language code that will be parsed into a locale.
+ */
+ public void setCurrentLocale(String language){
+ Locale locale = new Locale(language);
+ setCurrentLocale(locale);
+ }
+
+ /**
* Set the default locale for the entire application. After this call
* all views from this application will use this locale (unless a specific
* session defined a different locale using {@link #setLocale(Locale locale)}).
@@ -121,7 +133,7 @@ public class Locales implements Serializable {
* @param locale The locale to set
*/
public void setApplicationLocale(Locale locale) {
- setLocale(locale);
+ setCurrentLocale(locale);
getContext().getApplication().setDefaultLocale(this.locale);
}
--
libgit2 0.21.2