Skip to content

Commit

Permalink
SAK-23047
Browse files Browse the repository at this point in the history
chef-start now outputs a velocity placeholder for the html language and this gets populated by VelocityPortletPaneledAction, based on the current logged in user.


git-svn-id: https://source.sakaiproject.org/svn/velocity/trunk@117684 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
Adrian Fish committed Dec 13, 2012
1 parent 390ac99 commit 3aab031
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.text.DateFormat;
Expand Down Expand Up @@ -380,6 +381,16 @@ protected void toolModeDispatch(String methodBase, String methodExt, HttpServlet
UsageSession session = UsageSessionService.getSession();
if (session != null)
{
// SAK-23047 Set the proper country code in the chef_start generated markup
String userId = session.getUserId();
Locale locale = (new ResourceLoader(userId)).getLocale();
String languageCode = locale.getLanguage();
String countryCode = locale.getCountry();
if(countryCode != null && countryCode.length() > 0) {
languageCode += "_" + countryCode;
}
context.put("language",languageCode);

String browserId = session.getBrowserId();
if (UsageSession.WIN_IE.equals(browserId) || UsageSession.WIN_MZ.equals(browserId)
|| UsageSession.WIN_NN.equals(browserId) || UsageSession.MAC_MZ.equals(browserId)
Expand Down
2 changes: 1 addition & 1 deletion velocity/tool/src/templates/VM_chef_library.vm
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
#macro (chef_start)
#if ($sakai_fragment=='false')
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" lang="#if($language)$language#{else}en#end" xml:lang="#if($language)$language#{else}en#end">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
Expand Down

0 comments on commit 3aab031

Please sign in to comment.