Package org.olat.core.gui.translator

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


     * @param preselectedNames String containing the comma separated names that should be preselected
     * @param htmlElemId the name of the html id of the window that opened this popup controller
     */
    public GroupAndAreaSelectController(UserRequest ureq, WindowControl wControl, CourseGroupManager cgm, int type, String preselectedNames, String htmlElemId) {
        super(wControl);
        Translator trans = new PackageTranslator(PACKAGE,  ureq.getLocale());
        List namesList;
        this.htmlElemId = htmlElemId;
        // main window containg title and the cooser list
        main = new VelocityContainer("main",VELOCITY_ROOT + "/groupandareaselect.html", trans, this);

        // initialize some type specific stuff
        switch (type) {
        case 1:
            namesList = cgm.getUniqueLearningGroupNamesFromAllContexts();           
            main.contextPut("title", trans.translate("groupandareaselect.groups.title"));
            main.contextPut("noChoicesText", trans.translate("groupandareaselect.groups.nodata"));
            break;
        case 2:
            namesList = cgm.getUniqueAreaNamesFromAllContexts();           
            main.contextPut("title", trans.translate("groupandareaselect.areas.title"));
            main.contextPut("noChoicesText", trans.translate("groupandareaselect.areas.nodata"));
            break;
        default:
            throw new OLATRuntimeException("Must use valid type. type::" + type, null);
        }
       
View Full Code Here


    super(wControl);
    if (addCallback != null) {
      FeedManager manager = FeedManager.getInstance();
      // Create a new podcast feed resource
      feedResource = manager.createBlogResource();
      Translator trans = new PackageTranslator("org.olat.repository", ureq.getLocale());
      addCallback.setDisplayName(trans.translate(feedResource.getResourceableTypeName()));
      addCallback.setResourceable(feedResource);
      addCallback.setResourceName(manager.getFeedKind(feedResource));
      addCallback.finished(ureq);
    }
  }
View Full Code Here

      String[] identifyerSplit = helpPageIdentifyer.split(":");
      String bundleName = identifyerSplit[0];
      String page = identifyerSplit[1];
      // Translator with default locale. Locale is set to each language in the
      // language iteration below
      Translator pageTranslator = new PackageTranslator(bundleName, I18nModule.getDefaultLocale());
      // Open velocity page for this help page
      String pagePath = bundleName.replace('.', '/') + ContextHelpModule.CHELP_DIR + page;
      VelocityContainer container =  new VelocityContainer("contextHelpPageVC", pagePath, pageTranslator, null);         
      Context ctx = container.getContext();   
      GlobalSettings globalSettings = new GlobalSettings() {
        public int getFontSize() { return 100;}
        public AJAXFlags getAjaxFlags() { return new EmptyAJAXFlags();}
        public ComponentRenderer getComponentRendererFor(Component source) {
          return null;
        }
        public boolean isIdDivsForced() { return false; }
      };
      Renderer renderer = Renderer.getInstance(container, pageTranslator, new EmptyURLBuilder(), null, globalSettings);
      // Add render decorator with helper methods
      VelocityRenderDecorator vrdec = new VelocityRenderDecorator(renderer, container);     
      ctx.put("r", vrdec);
      // Add empty static dir url - only used to not generate error messages
      ctx.put("chelpStaticDirUrl", "");
      // Create document for each language using the velocity context
      for (String langCode : languages) {
        Locale locale = I18nManager.getInstance().getLocaleOrNull(langCode);
        String relPagePath = langCode + "/" + bundleName + "/" + page;
        if (log.isDebug()) log.debug("Indexing help page with path::" + relPagePath);
        SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
        searchResourceContext.setBusinessControlFor(OresHelper.createOLATResourceableType(ContextHelpModule.class.getSimpleName()));//to match the list of indexer
        // Create context help document and index now, set translator to current locale
        pageTranslator.setLocale(locale);
        Document document = ContextHelpDocument.createDocument(searchResourceContext, bundleName, page, pageTranslator, ctx, pagePath);
        indexWriter.addDocument(document);
      }
     
    }
View Full Code Here

   * @param language
   * @return Description text.
   */
  @SuppressWarnings("unchecked")
  public String getDescription(Locale locale) {
    Translator trans = getPackageTranslatorForLocale(locale);
    String desc = trans.translate("authentication.provider.description");
    return desc;
  }
View Full Code Here

   * [used by velocity]
   * @param language
   * @return Link text used to display a link to switch to this authentication provider.
   */
  public String getLinktext(Locale locale) {
    Translator trans = getPackageTranslatorForLocale(locale);
    String text = trans.translate("authentication.provider.linkText");
    return text;
  }
View Full Code Here

  /**
   * @see org.olat.modules.webFeed.ui.FeedUIFactory#setTranslator(java.util.Locale)
   */
  public void setTranslator(Locale locale) {
    final Translator fallbackTans = Util.createPackageTranslator(FeedMainController.class, locale);
    translator = Util.createPackageTranslator(BlogUIFactory.class, locale, fallbackTans);
  }
View Full Code Here

  /**
   * @see org.olat.modules.webFeed.ui.FeedUIFactory#setTranslator(java.util.Locale)
   */
  public void setTranslator(Locale locale) {
    final Translator fallbackTans = Util.createPackageTranslator(FeedMainController.class, locale);
    translator = Util.createPackageTranslator(PodcastUIFactory.class, locale, fallbackTans);
  }
View Full Code Here

    super(wControl);
    if (addCallback != null) {
      FeedManager manager = FeedManager.getInstance();
      // Create a new podcast feed resource
      feedResource = manager.createPodcastResource();
      Translator trans = new PackageTranslator("org.olat.repository", ureq.getLocale());
      addCallback.setDisplayName(trans.translate(feedResource.getResourceableTypeName()));
      addCallback.setResourceable(feedResource);
      addCallback.setResourceName(manager.getFeedKind(feedResource));
      addCallback.finished(ureq);
    }
  }
View Full Code Here

    // The metadata key selection, e.g DC.language for doublin core language metadata
    List<String> metaDataList = metadataProvider.getAdvancedSearchableFields();
    if (metaDataList.size() > 0) {
      String[] metaDataFields = ArrayHelper.toArray(metaDataList);
      String[] metaDataFieldsTranslated = new String[metaDataFields.length];
      Translator metaTranslator = metadataProvider.createFieldsTranslator(getLocale());
      for (int i=0; i < metaDataFields.length; i++) {
        String key = metaDataFields[i];
        metaDataFieldsTranslated[i] = key + " (" + metaTranslator.translate(key) + ")";
      }
      metadataType = uifactory.addDropdownSingleselect("metadata_type", "form.search.label.metadatatype", formLayout, metaDataFields, metaDataFieldsTranslated, null);
      metadataQuery = uifactory.addTextElement("metadata_query", null, 255, "", formLayout);
    }
   
View Full Code Here

   * @param th
   * @param detailedmessage
   * @param supportEmail
   */
  public MessageWindowController(UserRequest ureq, Throwable th, String detailedmessage, String supportEmail) {
    Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
    //Formatter formatter = Formatter.getInstance(ureq.getLocale());
    msg = new VelocityContainer("olatmain", VELOCITY_ROOT + "/message.html", trans, this);
           
    Tracing.logWarn(th.getMessage() + " *** User info: " + detailedmessage, th.getClass());
   
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.