Search in sources :

Example 56 with Translator

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;
}
Also used : Translator(org.olat.core.gui.translator.Translator)

Example 57 with Translator

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;
}
Also used : Translator(org.olat.core.gui.translator.Translator)

Example 58 with Translator

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();
}
Also used : Translator(org.olat.core.gui.translator.Translator)

Example 59 with Translator

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();
}
Also used : Translator(org.olat.core.gui.translator.Translator) Vector(java.util.Vector)

Example 60 with Translator

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 "-";
}
Also used : Translator(org.olat.core.gui.translator.Translator)

Aggregations

Translator (org.olat.core.gui.translator.Translator)586 Identity (org.olat.core.id.Identity)62 Date (java.util.Date)54 Controller (org.olat.core.gui.control.Controller)54 RepositoryEntry (org.olat.repository.RepositoryEntry)54 Locale (java.util.Locale)52 PackageTranslator (org.olat.core.gui.translator.PackageTranslator)46 ArrayList (java.util.ArrayList)40 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)40 NodeEditController (org.olat.course.editor.NodeEditController)40 TitleItem (org.olat.core.commons.services.notifications.model.TitleItem)36 Roles (org.olat.core.id.Roles)36 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)36 SubscriptionListItem (org.olat.core.commons.services.notifications.model.SubscriptionListItem)32 Publisher (org.olat.core.commons.services.notifications.Publisher)30 SubscriptionInfo (org.olat.core.commons.services.notifications.SubscriptionInfo)30 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)30 MailBundle (org.olat.core.util.mail.MailBundle)28 ICourse (org.olat.course.ICourse)26 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)26