Package org.olat.core.gui.translator

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


          logError("Could not parse forum key!", e);
          NotificationsManager.getInstance().deactivate(p);
          return NotificationsManager.getInstance().getNoSubscriptionInfo();
        }
        final List<Message> mInfos = ForumManager.getInstance().getNewMessageInfo(forumKey, compareDate);
        final Translator translator = Util.createPackageTranslator(ForumNotificationsHandler.class, locale);
       
        businessControlString = p.getBusinessPath() + "[Message:";
       
        si = new SubscriptionInfo(getTitleItem(p, translator), null);
        for (Message mInfo : mInfos) {
          String title = mInfo.getTitle();
          Identity creator = mInfo.getCreator();
          Identity modifier = mInfo.getModifier();
          Date modDate = mInfo.getLastModified();
         
          String name;
          if(modifier != null) {
            name = NotificationHelper.getFormatedName(modifier);
          } else {
            name = NotificationHelper.getFormatedName(creator);
          }
          String desc = translator.translate("notifications.entry", new String[] { title, name })
          String urlToSend = null;
          if(p.getBusinessPath() != null) {
            urlToSend = NotificationHelper.getURLFromBusinessPathString(p, businessControlString + mInfo.getKey().toString() + "]");
          }
         
View Full Code Here


    }
  }

  @Override
  public String createTitleInfo(Subscriber subscriber, Locale locale) {
    Translator translator = Util.createPackageTranslator(ForumNotificationsHandler.class, locale);
    TitleItem title = getTitleItem(subscriber.getPublisher(), translator);
    return title.getInfoContent("text/plain");
  }
View Full Code Here

   * @param course
   * @param locale
   * @return String
   */
  public static String createCourseResultsOverviewTable(List identities, List myNodes, ICourse course, Locale locale) {
      Translator t = new PackageTranslator(PACKAGE, locale);
      StringBuilder tableHeader1 = new StringBuilder();
    StringBuilder tableHeader2 = new StringBuilder();
    StringBuilder tableContent = new StringBuilder();
    StringBuilder table = new StringBuilder();

    String sequentialNumber = t.translate("column.header.seqnum");
    String login = t.translate("column.header.login");
    // user properties are dynamic
    String sc = t.translate("column.header.score");
    String pa = t.translate("column.header.passed");
    String co = t.translate("column.header.comment");
    String cco = t.translate("column.header.coachcomment");
    String at = t.translate("column.header.attempts");
    String na = t.translate("column.field.notavailable");
    String mi = t.translate("column.field.missing");
    String yes = t.translate("column.field.yes");
    String no = t.translate("column.field.no");

   
    tableHeader1.append(sequentialNumber);
    tableHeader1.append("\t");
    tableHeader2.append("\t");
   
    tableHeader1.append(login);
    tableHeader1.append("\t");
    tableHeader2.append("\t");
    // get user property handlers for this export, translate using the fallback
    // translator configured in the property handler
   
    List<UserPropertyHandler> userPropertyHandlers = UserManager.getInstance().getUserPropertyHandlersFor(
        ScoreAccountingHelper.class.getCanonicalName(), true);
    t = UserManager.getInstance().getPropertyHandlerTranslator(t);
    for (UserPropertyHandler propertyHandler : userPropertyHandlers) {
      tableHeader1.append(t.translate(propertyHandler.i18nColumnDescriptorLabelKey()));
      tableHeader1.append("\t");     
      tableHeader2.append("\t");
    }       

    // preload user properties cache
    course.getCourseEnvironment().getAssessmentManager().preloadCache();
   
    boolean firstIteration = true;
    int rowNumber = 1;
    Iterator iterIdentities = identities.iterator();
    while (iterIdentities.hasNext()) {
      Identity identity = (Identity) iterIdentities.next();
      String uname = identity.getName();

      tableContent.append(rowNumber);
      tableContent.append("\t");
      tableContent.append(uname);
      tableContent.append("\t");
      // add dynamic user properties
      for (UserPropertyHandler propertyHandler : userPropertyHandlers) {
        String value = propertyHandler.getUserProperty(identity.getUser(), t.getLocale());
        tableContent.append((StringHelper.containsNonWhitespace(value) ? value : na));
        tableContent.append("\t");     
      }

      // create a identenv with no roles, no attributes, no locale
View Full Code Here

          businessControlString = p.getBusinessPath() + "[path=";
        }
       
        Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
        final List<WikiPage> pages = wiki.getPagesByDate();
        Translator translator = Util.createPackageTranslator(WikiPageChangeOrCreateNotificationHandler.class, locale);
       
        TitleItem title = getTitleItem(p, translator);
        si = new SubscriptionInfo(title, null);
          SubscriptionListItem subListItem;
            for (Iterator<WikiPage> it = pages.listIterator(); it.hasNext();) {           
              WikiPage element = it.next();
             
              // do only show entries newer then the ones already seen
              Date modDate = new Date(element.getModificationTime());
              logDebug("modDate=" + modDate + " ; compareDate=" + compareDate, null);
              if (modDate.after(compareDate)) {
                if((element.getPageName().startsWith("O_") || element.getPageName().startsWith(WikiPage.WIKI_MENU_PAGE)) &&
                    (element.getModifyAuthor() <= 0)) {
                    //theses pages are created sometimes automatically. Check if this is the case
                    continue;
                }

                //build Businesscontrol-Path           
                String bControlString = businessControlString + element.getPageName() + "]";           
                String urlToSend = null;
                if(p.getBusinessPath() != null) {
                  urlToSend = NotificationHelper.getURLFromBusinessPathString(p, bControlString);
                }
               
                // string[] gets filled into translation key by adding {0...n} to
                // the string
                Identity ident = ManagerFactory.getManager().loadIdentityByKey(Long.valueOf(element.getModifyAuthor()));
                String desc = translator.translate("notifications.entry", new String[] { element.getPageName(), NotificationHelper.getFormatedName(ident)});             
                subListItem = new SubscriptionListItem(desc, urlToSend, modDate, CSS_CLASS_WIKI_PAGE_CHANGED_ICON);
                si.addSubscriptionListItem(subListItem);
              } else {
                //there are no more new pages so we stop here
                break;
View Full Code Here

  }

  @Override
  public String createTitleInfo(Subscriber subscriber, Locale locale) {
    try {
      Translator translator = Util.createPackageTranslator(WikiPageChangeOrCreateNotificationHandler.class, locale);
      TitleItem title = getTitleItem(subscriber.getPublisher(), translator);
      return title.getInfoContent("text/plain");
    } catch (Exception e) {
      logError("Error while creating assessment notifications for subscriber: " + subscriber.getKey(), e);
      checkPublisher(subscriber.getPublisher());
View Full Code Here

    // -- VERY RARE CASE -- 1) qti is open in an editor session right now on the screen (or session on the way to timeout)
    // -- 99% of cases   -- 2) qti is ready to be run as test/survey
    String repositorySoftkey = (String) moduleConfiguration.get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftkey, true);
    if (CoordinatorManager.getCoordinator().getLocker().isLocked(re.getOlatResource(), null)){
      Translator translator = Util.createPackageTranslator(this.getClass(), ureq.getLocale());
      //so this resource is locked, let's find out who locked it
      LockResult lockResult = CoordinatorManager.getCoordinator().getLocker().acquireLock(re.getOlatResource(), ureq.getIdentity(), null);
      return MessageUIFactory.createInfoMessage(ureq, wControl, translator.translate("status.currently.locked.title"),
          translator.translate("status.currently.locked", new String[] {lockResult.getOwner().getName()}));
    }else{
      ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(re, OlatResourceableType.iq));
      return new IQDisplayController(moduleConfiguration, secCallback, ureq, wControl, callingResId, callingResDetail);
    }
  }
View Full Code Here

      private Panel empty;
      private LayoutMain3ColsController columnLayoutCtr;

      @Override
      public void init(UserRequest ureq) {
        empty = new Panel("empty");      Translator translator = Util.createPackageTranslator(this.getClass(), ureq.getLocale());
        contentCtr = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translator.translate("status.currently.locked.title"), translator.translate("status.currently.locked"));
        listenTo(contentCtr); // auto dispose later
        Component resComp = contentCtr.getInitialComponent();

        columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), empty, empty, resComp, /*do not save no prefs*/null);
        listenTo(columnLayoutCtr); // auto dispose later
View Full Code Here

   *
   * @param locale
   * @return
   */
  public String getShortDescription(Locale locale) {
    Translator f = new PackageTranslator(fallbackTranslatorStr, locale);
    Translator t = new PackageTranslator(transPckg, locale, f);
    return t.translate(shortDesc, params);
  }
View Full Code Here

   *
   * @param locale
   * @return
   */
  public String getLongDescription(Locale locale) {
    Translator f = new PackageTranslator(fallbackTranslatorStr, locale);
    Translator t = new PackageTranslator(transPckg, locale, f);
    return t.translate(longDesc, params);
  }
View Full Code Here

    } else if (groupContexts.size() == 1) {
      BGContext context = (BGContext) groupContexts.get(0);
      doInitGroupmanagement(ureq, context, false);
    } else {
      // multiple, show list first
      Translator fallback = new PackageTranslator(Util.getPackageName(BGContextEditController.class), ureq.getLocale());
      setTranslator(Util.createPackageTranslator(this.getClass(), ureq.getLocale(), fallback));
      doInitContextListLayout(ureq);
      doInitContextList(ureq, groupContexts);
    }
   
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.