use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class NotesPortlet method createInstance.
/**
* @see org.olat.gui.control.generic.portal.AbstractPortlet#createInstance(org.olat.core.gui.control.WindowControl, org.olat.core.gui.UserRequest, java.util.Map)
*/
public Portlet createInstance(WindowControl wControl, UserRequest ureq, Map<String, String> configuration) {
Translator translator = Util.createPackageTranslator(NotesPortlet.class, ureq.getLocale());
NotesPortlet p = new NotesPortlet();
p.setName(this.getName());
p.setConfiguration(configuration);
p.setDefaultMaxEntries(getDefaultMaxEntries());
p.setTranslator(translator);
return p;
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class GenderPropertyHandler method getUserProperty.
/**
* @see org.olat.user.AbstractUserPropertyHandler#getUserProperty(org.olat.core.id.User, java.util.Locale)
*/
@Override
public String getUserProperty(User user, Locale locale) {
Translator myTrans;
if (locale == null) {
myTrans = Util.createPackageTranslator(this.getClass(), I18nModule.getDefaultLocale());
} else {
myTrans = Util.createPackageTranslator(this.getClass(), locale);
}
String internalValue = getInternalValue(user);
String displayValue = myTrans.translate("form.name.gender." + internalValue);
return displayValue;
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class GenericSelectionPropertyHandler method getUserPropertyAsHTML.
/**
* @see org.olat.core.id.UserField#getUserFieldValueAsHTML(org.olat.core.id.User,
* java.util.Locale)
*/
public String getUserPropertyAsHTML(User user, Locale locale) {
StringBuilder htmlValue = new StringBuilder();
Translator trans = Util.createPackageTranslator(this.getClass(), locale);
if (isMultiSelect()) {
for (String value : getInternalValue(user).split(KEY_DELIMITER)) {
htmlValue.append(trans.translate(value)).append(" ");
}
} else {
htmlValue.append(trans.translate(getInternalValue(user)));
}
return htmlValue.toString();
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class UserInterestsPropertyHandler method getUserPropertyAsHTML.
/**
* @see org.olat.user.AbstractUserPropertyHandler#getUserPropertyAsHTML(org.olat.core.id.User, java.util.Locale)
*/
@Override
public String getUserPropertyAsHTML(User user, Locale locale) {
if (locale == null) {
locale = I18nManager.getInstance().getCurrentThreadLocale();
}
Translator packageTranslator = Util.createPackageTranslator(PACKAGE_UINTERESTS, locale, null);
StringBuilder sb = new StringBuilder(256);
if (getInternalValue(user) != null) {
String[] userInterestsIDs = getInternalValue(user).split(":");
List<String> sortedUserInterestsIDs = new Vector<String>();
for (String id : userInterestsIDs) {
if (!id.equals("")) {
sortedUserInterestsIDs.add(id);
}
}
Collections.sort(sortedUserInterestsIDs, new UserInterestsComparator());
sb.append("<table class=\"b_table\"><tbody>");
for (String id : sortedUserInterestsIDs) {
sb.append("<tr><td>");
sb.append(packageTranslator.translate(UserInterestsPropertyHandler.SUBCATEGORY_I18N_PREFIX + id));
sb.append("</td></tr>");
}
sb.append("</tbody></table>");
}
return sb.toString();
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class GenericYesNoPropertyHandler method getUserProperty.
@Override
public String getUserProperty(User user, Locale locale) {
Translator trans = Util.createPackageTranslator(this.getClass(), locale);
String internalValue = getInternalValue(user);
if (VAL_YES.equals(internalValue))
return trans.translate("yes");
if (VAL_NO.equals(internalValue))
return trans.translate("no");
return "-";
}
Aggregations