1 16 package org.apache.jetspeed.services.customlocalization; 17 18 import java.util.Locale ; 19 20 import org.apache.turbine.services.localization.TurbineLocalizationService; 21 import org.apache.turbine.util.RunData; 22 23 import org.apache.jetspeed.om.security.JetspeedUser; 24 25 42 public class JetspeedLocalizationService extends TurbineLocalizationService implements CustomLocalizationService 43 { 44 45 74 75 80 86 87 95 public final Locale getLocale(RunData data) 96 { 97 JetspeedUser user = (JetspeedUser) data.getUser(); 98 if (user == null) 99 { 100 return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE)); 101 } 102 else 103 { 104 String lang = "null"; 105 106 try 107 { 108 if (user.getPerm("language") == null) 109 { 110 return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE)); 111 } 112 else 113 { 114 lang = user.getPerm("language").toString(); 115 Locale locale = new Locale (lang, ""); 116 return locale; 117 } 118 } 119 catch (Exception use) 120 { 121 return getLocale(data.getRequest().getHeader(CustomLocalizationService.ACCEPT_LANGUAGE)); 122 } 123 } 124 } 125 126 139 140 171 172 } 173 | Popular Tags |