Package org.olat.core.gui.translator

Examples of org.olat.core.gui.translator.Translator


   * Initial Date: 26.11.2007<br>
   *
   * @author Florian Gnaegi, frentix GmbH, http://www.frentix.com
   */
  public static DialogBoxController createYesNoDialog(UserRequest ureq, WindowControl wControl, String title, String text) {
    Translator trans = Util.createPackageTranslator(DialogBoxUIFactory.class, ureq.getLocale());
    List<String> yesNoButtons = new ArrayList<String>();
    yesNoButtons.add(trans.translate("yes"));
    yesNoButtons.add(trans.translate("no"));
    DialogBoxController dialogCtr = new DialogBoxController(ureq, wControl, title, text, yesNoButtons);
    return dialogCtr;
  }
View Full Code Here


   * Initial Date: 26.11.2007<br>
   *
   * @author Florian Gnaegi, frentix GmbH, http://www.frentix.com
   */
  public static DialogBoxController createOkCancelDialog(UserRequest ureq, WindowControl wControl, String title, String text) {
    Translator trans = Util.createPackageTranslator(DialogBoxUIFactory.class, ureq.getLocale());
    List<String> okCancelButtons = new ArrayList<String>();
    okCancelButtons.add(trans.translate("ok"));
    okCancelButtons.add(trans.translate("cancel"));
    DialogBoxController dialogCtr = new DialogBoxController(ureq, wControl, title, text, okCancelButtons);
    return dialogCtr;
  }
View Full Code Here

    }
    String[] i18nParams = new String[] { lockEntry.getOwner().getName(),
        Formatter.getInstance(ureq.getLocale()).formatTime(new Date(lockEntry.getLockAquiredTime())) };
    String lockMsg = translator.translate(i18nLockMsgKey, i18nParams);
   
    Translator trans = Util.createPackageTranslator(DialogBoxUIFactory.class, ureq.getLocale());
    List<String> okButton = new ArrayList<String>();
    okButton.add(trans.translate("ok"));
   
    return new DialogBoxController(ureq, wControl, null, lockMsg, okButton);
  }
View Full Code Here

    }
  }


  private String getPlaintextContent(Locale locale) {
    Translator trans = Util.createPackageTranslator(SubscriptionInfo.class, locale);
    Formatter form = Formatter.getInstance(locale);
    StringBuilder sb = new StringBuilder();
    String datePart = trans.translate("subscription.listitem.dateprefix", new String [] { form.formatDateAndTime(date) } ) ;
    sb.append("- ");
    sb.append(description.trim());
    sb.append(" ").append(datePart.trim());
    if (StringHelper.containsNonWhitespace(link)) sb.append("\n").append("  ").append(link);
    return sb.toString();
View Full Code Here

    return sb.toString();
  }

  private String getHTMLContent(Locale locale) {
    StringBuilder sb = new StringBuilder();
    Translator trans = Util.createPackageTranslator(SubscriptionInfo.class, locale);
    Formatter form = Formatter.getInstance(locale);
    String datePart = trans.translate("subscription.listitem.dateprefix", new String [] { form.formatDateAndTime(date) } ) ;
    if (iconCssClass != null) {
      sb.append("<li class=\"b_with_small_icon_left ");
      sb.append(iconCssClass);
      sb.append("\">");
    } else {
View Full Code Here

   * @param cel
   * @param userObject
   * @return the controller
   */
  public static DialogController createYesNoDialogController(Locale locale, String text, ControllerEventListener cel, Object userObject) {
    Translator intTrans = new PackageTranslator(PACKAGE, locale);
    DialogController dc = new DialogController(locale, intTrans.translate("answer.yes"), intTrans.translate("answer.no"), text, userObject, true, null);
    // when used with basic controller listener has to be set with listenTo()
    if (cel != null) dc.addControllerListener(cel);
    return dc;
  }
View Full Code Here

   * @param text
   * @param cel
   * @return the controller
   */
  public static DialogController createOkCancelDialogController(Locale locale, String text, ControllerEventListener cel) {
    Translator intTrans = new PackageTranslator(PACKAGE, locale);
    DialogController dc = new DialogController(locale, intTrans.translate("answer.ok"), intTrans.translate("answer.cancel"), text);
    // when used with basic controller listener has to be set with listenTo()   
    if (cel != null) dc.addControllerListener(cel);
    return dc;
  }
View Full Code Here

        "GenericTreeNode to append/prepend needs to have a UserObject set! Please use setUserObject()."); }
  }

  private TreeModel buildTreeModel() {
    GenericTreeNode gtnChild, rootTreeNode;
    Translator translator = getTranslator();

    GenericTreeModel gtm = new GenericTreeModel();
    rootTreeNode = new GenericTreeNode();
    //there should be i18n key for main.menu.title for the rootNode in package of implementing type
    rootTreeNode.setTitle(translator.translate("main.menu.title"));
    rootTreeNode.setAltText(translator.translate("main.menu.title.alt"));
    gtm.setRootNode(rootTreeNode);

    // Prepend
    boolean rootNodeSet = false;
    if (nodesToPrepend.size() != 0) {
View Full Code Here

    int lastDot = filePath.lastIndexOf('.');
    if (lastDot > 0) {
      if (lastDot < filePath.length())
        return filePath.substring(lastDot + 1).toLowerCase();
    }
    Translator translator = Util.createPackageTranslator(FolderHelper.class, locale);
    return translator.translate("UnknownFile");
  }
View Full Code Here

   */
  public void render(Renderer renderer, StringOutput target, Component source, URLBuilder ubu, Translator translator,
      RenderResult renderResult, String[] args) {

    SelectionTree tree = (SelectionTree) source;
    Translator internalTranslator = tree.getTranslator();
    TreeNode root = tree.getTreeModel().getRootNode();

    target.append(tree.isMultiselect() ? SCRIPT_MULTI_PRE : SCRIPT_SINGLE_PRE);
    target.append(translator.translate("alert"));
    target.append(SCRIPT_POST);
    target.append("<div class=\"b_selectiontree\"><form method=\"post\" name=\"seltree\" action=\"");
    boolean iframePostEnabled = renderer.getGlobalSettings().getAjaxFlags().isIframePostEnabled();
    ubu.buildURI(target, null, null, iframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    target.append("\"");
    if (iframePostEnabled) {
      ubu.appendTarget(target);
    }
    target.append(" id=\"").append(FormRenderer.JSFORMID).append(tree.hashCode()).append("\"");
    target.append(">");
    // append root node
    renderRootNode(root, target);
    boolean atLeastOneIsAccessible = atLeastOneIsAccessible(root);
    if (root.getChildCount() != 0) {
      renderChildNodes(root, "", tree.hashCode(), tree.isMultiselect(), tree.getGreyOutNonSelectableEntries(), tree.isShowAltTextAsHoverOnTitle(), target);
      if (tree.isMultiselect() && atLeastOneIsAccessible) {
        target.append("<div class=\"b_togglecheck\"><a href=\"javascript:checkall(true);setFormDirty('").append(FormRenderer.JSFORMID).append(tree.hashCode()).append("');\">");
        target.append("<input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\" />");
        target.append(translator.translate("checkall"));
        target.append("</a>&nbsp;<a href=\"javascript:checkall(false);setFormDirty('").append(FormRenderer.JSFORMID).append(tree.hashCode()).append("\');\">");
        target.append("<input type=\"checkbox\" disabled=\"disabled\" />");
        target.append(translator.translate("uncheckall"));
        target.append("</a></div>");
      }
    }
    else target.append(internalTranslator.translate("selectiontree.noentries"));
    target.append("<br /><br />");
    if (atLeastOneIsAccessible) {
      target.append("<button type=\"submit\" class=\"b_button\" name=\"" + Form.SUBMIT_IDENTIFICATION + "\" value=\"");
      target.append(StringEscapeUtils.escapeHtml(translator.translate(tree.getFormButtonKey())));
      if (!tree.isAllowEmptySelection()) {
View Full Code Here

TOP

Related Classes of org.olat.core.gui.translator.Translator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.