Package org.bladerunnerjs.plugin

Examples of org.bladerunnerjs.plugin.Locale


      case LOCALE_FORWARDING_REQUEST:
      case WORKBENCH_LOCALE_FORWARDING_REQUEST:
        return getLocaleForwardingPageContent(app.aspect(aspectName).getBundleSet(), contentAccessor, devVersion);

      case INDEX_PAGE_REQUEST:
        return getIndexPageContent(app.aspect(aspectName), new Locale(pathProperties.get("locale")), devVersion, contentAccessor, RequestMode.Dev);

      case WORKBENCH_INDEX_PAGE_REQUEST:
        return getIndexPageContent(app.bladeset(pathProperties.get("bladeset")).blade(pathProperties.get("blade")).workbench(), new Locale(pathProperties.get("locale")), devVersion, contentAccessor, RequestMode.Dev);
     
      case UNVERSIONED_BUNDLE_REQUEST:
        return app.aspect(aspectName).handleLogicalRequest("/"+pathProperties.get("content-path"), contentAccessor, devVersion);
       
      case BUNDLE_REQUEST:
View Full Code Here


  public ResponseContent handleRequest(ParsedContentPath contentPath, BundleSet bundleSet, UrlContentAccessor output, String version) throws ContentProcessingException {
   
    String theme = contentPath.properties.get("theme");
    String languageCode = contentPath.properties.get("languageCode");
    String countryCode = contentPath.properties.get("countryCode");
    Locale locale = new Locale(languageCode, countryCode);

    List<Reader> readerList = new ArrayList<Reader>();
    List<Asset> cssAssets = getCssAssets(bundleSet, cssAssetPlugin);
    for(Asset cssAsset : cssAssets) {
      String assetThemeName = getThemeName(cssAsset.assetLocation());
     
      if(assetThemeName.equals(theme) && cssAsset.getAssetName().matches(locale.getLocaleFilePattern(".*_", ".css"))) {
        CssRewriter processor = new CssRewriter(cssAsset);
       
        try {
          String css = processor.getFileContents();
          readerList.add(new StringReader(css));
View Full Code Here

     
      for(Asset cssAsset : bundleSet.getResourceFiles(cssAssetPlugin)) {
        AssetLocation cssAssetLocation = cssAsset.assetLocation();
        String themeName = (cssAssetLocation instanceof ThemedAssetLocation) ? ((ThemedAssetLocation) cssAssetLocation).getThemeName() : "common";
       
        Locale assetLocale = Locale.createLocaleFromFilepath(".*_", cssAsset.getAssetName());
       
        if(assetLocale.isEmptyLocale()) {
          contentPaths.add(getContentPathParser().createRequest("simple-request", themeName));
        }
        else {
          if(supportedLocales.contains(assetLocale)) {
            if (!assetLocale.isCompleteLocale()) {
              contentPaths.add(getContentPathParser().createRequest("language-request", themeName, assetLocale.getLanguageCode()));
            } else {
              contentPaths.add(getContentPathParser().createRequest("locale-request", themeName, assetLocale.getLanguageCode(), assetLocale.getCountryCode()));
            }
          }
        }
      }
    }
View Full Code Here

  }

  @Override
  public ResponseContent handleRequest(ParsedContentPath contentPath, BundleSet bundleSet, UrlContentAccessor contentAccessor, String version) throws ContentProcessingException
  {
    Locale locale = new Locale(contentPath.properties.get(LANGUAGE_PROPERTY_NAME), contentPath.properties.get(COUNTRY_PROPERTY_NAME));
    if (contentPath.formName.equals(LANGUAGE_BUNDLE))
    {
      return generateBundleForLocale(bundleSet, locale);
    }
    else if (contentPath.formName.equals(LANGUAGE_AND_LOCATION_BUNDLE))
View Full Code Here

    for (Asset asset : propertyAssets)
    {
      if (asset instanceof I18nFileAsset)
      {
        I18nFileAsset i18nAsset = (I18nFileAsset) asset;
        Locale assetLocale = i18nAsset.getLocale();
        if (assetLocale.isCompleteLocale())
        {
          languageAndLocationAssets.add(i18nAsset);
        }
        else if (!assetLocale.isEmptyLocale())
        {
          languageOnlyAssets.add(i18nAsset);
        }
      }
    }
View Full Code Here

  }
 
  private void filterAndAssert(String input, String expectedOutput, BundleSet bundleSet, RequestMode opMode, String locale) throws Exception
  {
    StringWriter writer = new StringWriter();
    TagPluginUtility.filterContent(input, bundleSet, writer, opMode, new Locale(locale), brjs.getAppVersionGenerator().getDevVersion());
    assertEquals(expectedOutput, writer.toString());
  }
View Full Code Here

    assertEquals(expectedOutput, writer.toString());
  }
 
  private void filterAndAssertMapReturned(String input, Map<String,Map<String,String>> expectedResult, BundleSet bundleSet, RequestMode opMode, String locale) throws Exception
  {
     Map<String,Map<String,String>> actualResult = TagPluginUtility.getUsedTagsAndAttributes(input, bundleSet, opMode, new Locale(locale), brjs.getAppVersionGenerator().getDevVersion());
    assertEquals(expectedResult, actualResult);
  }
View Full Code Here

  }
 
  private boolean localeMatches(String contentPath, Locale locale) throws MalformedRequestException {
    String contentPathLanguageCode = cssContentPlugin.getContentPathParser().parse(contentPath).properties.get("languageCode");
    String contentPathCountryCode = cssContentPlugin.getContentPathParser().parse(contentPath).properties.get("countryCode");
    Locale contentPathLocale = new Locale(contentPathLanguageCode, contentPathCountryCode);
    return ( contentPathLocale.isEmptyLocale() || locale.isAbsoluteOrPartialMatch(contentPathLocale) );
  }
View Full Code Here

 
  private void verifyLocales(String locales) throws ConfigException {
    try {
        String[] localeStrings = locales.split("\\s*,\\s*");
        for (int i = 0; i < localeStrings.length; i++) {
          Locale locale = new Locale(localeStrings[i]);
          if (locale.isEmptyLocale()) {
            throw new ConfigException("Locales cannot be empty and must be in the format " + Locale.LANGUAGE_AND_COUNTRY_CODE_FORMAT);
          }
        }
    } catch (IllegalArgumentException ex) {
      throw new ConfigException("Error in the config file " + getUnderlyingFile().getPath(), ex);
View Full Code Here

  public AppConfCommander setLocales(final String locales) throws Exception {
    call(new Command() {
      public void call() throws Exception {
        List<Locale> createdLocales = new ArrayList<Locale>();
        for (String locale : locales.split(",")) {
          createdLocales.add( new Locale(locale) );
        }
        appConf.setLocales( createdLocales.toArray(new Locale[0]) );
        appConf.write();
      }
    });
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.plugin.Locale

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.