Author: sdumitriu
Date: 2008-02-22 06:03:42 +0100 (Fri, 22 Feb 2008)
New Revision: 7909

Modified:
   xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
Log:
XWIKI-2106: Ability to force a default language
Done. Added a new xwiki.cfg property, xwiki.language.preferDefault (defaults to 
false). When this property is set, if the user didn't explicitely request for a 
language, then instead of using the browser Accept-Language header, use the 
default language.


Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java 
2008-02-22 04:54:08 UTC (rev 7908)
+++ xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java 
2008-02-22 05:03:42 UTC (rev 7909)
@@ -1934,6 +1934,15 @@
         } catch (XWikiException e) {
         }
 
+        // If the default language is prefered, and since the user didn't 
explicitely ask for a
+        // language already, then use the default wiki language.
+        if (Param("xwiki.language.preferDefault", "0").equals("1")
+            || getWebPreference("preferDefaultLanguage", "0", 
context).equals("1")) {
+            language = defaultLanguage;
+            context.setLanguage(language);
+            return language;
+        }
+
         // Then from the navigator language setting
         if (context.getRequest() != null) {
             String accept = context.getRequest().getHeader("Accept-Language");

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to