Skip to content
Snippets Groups Projects
Commit 1c39f5f7 authored by srosse's avatar srosse
Browse files

OO-4059: give the locale to the user short description's panel

parent 607b9732
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,8 @@ public class UserShortDescription extends BasicController { ...@@ -84,7 +84,8 @@ public class UserShortDescription extends BasicController {
mainVC.contextPut("userPropertyHandlers", userPropertyHandlers); mainVC.contextPut("userPropertyHandlers", userPropertyHandlers);
mainVC.contextPut("user", identity.getUser()); mainVC.contextPut("user", identity.getUser());
mainVC.contextPut("identityKey", identity.getKey()); mainVC.contextPut("identityKey", identity.getKey());
mainVC.contextPut("usernamePosition", "top"); mainVC.contextPut("usernamePosition", "top");
mainVC.contextPut("locale", getLocale());
if(!alreadyDefinedUsername && (getIdentity().equals(identity) || isAdministrativeUser)) { if(!alreadyDefinedUsername && (getIdentity().equals(identity) || isAdministrativeUser)) {
mainVC.contextPut("username", identity.getName()); mainVC.contextPut("username", identity.getName());
} }
......
...@@ -111,7 +111,7 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler ...@@ -111,7 +111,7 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler
* saves the configuration of this property * saves the configuration of this property
*/ */
public void saveConfig() { public void saveConfig() {
Map<String, String> configMap = new HashMap<String, String>(); Map<String, String> configMap = new HashMap<>();
String isMulti = (isMultiselect) ? PROP_MULTISELECT_TRUE : "0"; String isMulti = (isMultiselect) ? PROP_MULTISELECT_TRUE : "0";
configMap.put(PROP_MULTISELECT, isMulti); configMap.put(PROP_MULTISELECT, isMulti);
...@@ -198,13 +198,9 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler ...@@ -198,13 +198,9 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler
* @return * @return
*/ */
private String[] getSelectedKeys(User user) { private String[] getSelectedKeys(User user) {
String[] keys = getInternalValue(user).split(KEY_DELIMITER); return getInternalValue(user).split(KEY_DELIMITER);
return keys;
} }
/**
* @see org.olat.user.AbstractUserPropertyHandler#getInternalValue(org.olat.core.id.User)
*/
@Override @Override
public String getInternalValue(User user) { public String getInternalValue(User user) {
String value = super.getInternalValue(user); String value = super.getInternalValue(user);
...@@ -289,10 +285,7 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler ...@@ -289,10 +285,7 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler
return values; return values;
} }
/** @Override
* @see org.olat.core.id.UserField#getUserFieldValueAsHTML(org.olat.core.id.User,
* java.util.Locale)
*/
public String getUserPropertyAsHTML(User user, Locale locale) { public String getUserPropertyAsHTML(User user, Locale locale) {
StringBuilder htmlValue = new StringBuilder(); StringBuilder htmlValue = new StringBuilder();
Translator trans = Util.createPackageTranslator(this.getClass(), locale); Translator trans = Util.createPackageTranslator(this.getClass(), locale);
...@@ -301,9 +294,11 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler ...@@ -301,9 +294,11 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler
htmlValue.append(trans.translate(value)).append(" "); htmlValue.append(trans.translate(value)).append(" ");
} }
} else { } else {
htmlValue.append(trans.translate(getInternalValue(user))); String val = getInternalValue(user);
if(val != null && locale != null) {
htmlValue.append(trans.translate(val));
}
} }
return htmlValue.toString(); return htmlValue.toString();
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment