Examples of Translation


Examples of org.broadleafcommerce.common.i18n.domain.Translation

        String localeCountryCode = localeCode;
        if (StringUtils.isNotBlank(locale.getCountry())) {
            localeCountryCode += "_" + locale.getCountry();
        }

        Translation translation;
       
        // First, we'll try to look up a country language combo (en_GB), utilizing the cache
        String countryCacheKey = getCacheKey(entityType, entityId, property, localeCountryCode);
        Element countryValue = getCache().get(countryCacheKey);
        if (countryValue != null) {
            statisticsService.addCacheStat(CacheStatType.TRANSLATION_CACHE_HIT_RATE.toString(), true);
            translation = (Translation) countryValue.getObjectValue();
        } else {
            statisticsService.addCacheStat(CacheStatType.TRANSLATION_CACHE_HIT_RATE.toString(), false);
            translation = getTranslation(entityType, entityId, property, localeCountryCode);
            if (translation == null) {
                translation = new TranslationImpl();
            }
            getCache().put(new Element(countryCacheKey, translation));
        }
       
        // If we don't find one, let's try just the language (en), again utilizing the cache
        if (translation.getTranslatedValue()==null) {
            String nonCountryCacheKey = getCacheKey(entityType, entityId, property, localeCode);
            Element nonCountryValue = getCache().get(nonCountryCacheKey);
            if (nonCountryValue != null) {
                statisticsService.addCacheStat(CacheStatType.TRANSLATION_CACHE_HIT_RATE.toString(), true);
                translation = (Translation) nonCountryValue.getObjectValue();
            } else {
                statisticsService.addCacheStat(CacheStatType.TRANSLATION_CACHE_HIT_RATE.toString(), false);
                translation = getTranslation(entityType, entityId, property, localeCode);
                if (translation == null) {
                    translation = new TranslationImpl();
                }
                getCache().put(new Element(nonCountryCacheKey, translation));
            }
        }
       
        // If we have a match on a translation, use that instead of what we found on the entity.
        if (StringUtils.isNotBlank(translation.getTranslatedValue())) {
            return translation.getTranslatedValue();
        }
       
        return null;
    }
View Full Code Here

Examples of org.mongodb.morphia.testmodel.Translation

                                                                articles.findOne(new BasicDBObject(Mapper.ID_KEY,
                                                                                                   relatedDbObj.get(Mapper.ID_KEY))),
                                                                new DefaultEntityCache());

        final Article article = new Article();
        article.setTranslation("en", new Translation("Hello World", "Just a test"));
        article.setTranslation("is", new Translation("Halló heimur", "Bara aư prófa"));

        article.setAttribute("myDate", new Date());
        article.setAttribute("myString", "Test");
        article.setAttribute("myInt", 123);
View Full Code Here

Examples of org.onebusaway.transit_data_federation.services.service_alerts.ServiceAlerts.TranslatedString.Translation

    assertEquals("stop", consequence.getDetourStopIds(0).getId());
    assertEquals(5, builder.getCreationTime());
    assertTrue(builder.hasDescription());
    TranslatedString descs = builder.getDescription();
    assertEquals(1, descs.getTranslationCount());
    Translation desc = descs.getTranslation(0);
    assertEquals("en", desc.getLanguage());
    assertEquals("description", desc.getText());
    assertEquals("ignore_this", builder.getId().getId());
    assertEquals(1, builder.getPublicationWindowCount());
    range = builder.getPublicationWindow(0);
    assertEquals(20L, range.getStart());
    assertEquals(40L, range.getEnd());
    assertEquals(Severity.VERY_SEVERE, builder.getSeverity());
    TranslatedString summaries = builder.getSummary();
    assertEquals(1, summaries.getTranslationCount());
    Translation summary = summaries.getTranslation(0);
    assertEquals("en", summary.getLanguage());
    assertEquals("summary", summary.getText());
    TranslatedString urls = builder.getUrl();
    assertEquals(1, urls.getTranslationCount());
    Translation url = urls.getTranslation(0);
    assertEquals("en", url.getLanguage());
    assertEquals("http://somewhere", url.getText());

    /**
     * Verify that the conversion from the ServiceAlert to ServiceAlertBean
     * looks good
     */
 
View Full Code Here

Examples of org.openstreetmap.osmosis.tagtransform.Translation

      DocumentBuilder builder = factory.newDocumentBuilder();
      Document doc = builder.parse(file);

      NodeList translationElements = doc.getDocumentElement().getElementsByTagName("translation");
      for (int i = 0; i < translationElements.getLength(); i++) {
        Translation t = parseTranslation((Element) translationElements.item(i));
        if (t != null) {
          translations.add(t);
        }
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.projectforge.core.Translation

  public String getLabel(final Locale locale)
  {
    if (locale == null || translations == null) {
      return getLabel();
    }
    final Translation translation = getTranslation(locale);
    if (translation != null) {
      return translation.getTranslation();
    }
    return getLabel();
  }
View Full Code Here

Examples of org.projectforge.core.Translation

    if (locale == null || translations == null) {
      return null;
    }
    String lang = locale.toString().toLowerCase();
    for (int i = 0; i < 4; i++) { // Endless loop protection.
      final Translation translation = getTranslation(lang);
      if (translation != null) {
        return translation;
      }
      final int pos = lang.lastIndexOf('_');
      if (pos > 0) {
View Full Code Here

Examples of org.projectforge.core.Translation

    return this;
  }

  MenuEntryConfig addTranslation(final Locale locale, final String translation)
  {
    return addTranslation(new Translation(locale, translation));
  }
View Full Code Here

Examples of purrpackagedemo.Transformation.Translation

    assertEquals( a + "," + b, a.y, b.y, .000001 );
  }
 
  @Test
  public void testTransformationsOnPoints() {
    Translation t = new Translation( 3, -2.5 );
    assertPointEquals( new Point( 3, -2.5 ), t.apply( Point.ORIGIN ));
    assertPointEquals( new Point( 4, -1.5 ), t.apply( new Point( 1, 1 ) ) );
   
    Rotation r = new Rotation( Math.PI / 2.0 );
    assertPointEquals( new Point( 0, 1 ), r.apply( new Point( 1, 0 )) );
    assertPointEquals( new Point( -2, 0 ), r.apply( r.apply( new Point( 2, 0 ))) );
   
View Full Code Here

Examples of purrpackagedemo.Transformation.Translation

  @Test
  public void testTransformationsOnRegions() {
    Point[] ps = new Point[] { Point.ORIGIN, new Point( 0.5, -0.5 ), new Point( 1, 1 ) };
    Transformation[] ts = new Transformation[] { new Transformation.Expansion( 2.0 ),
        new Transformation.Rotation( 1 ), new Translation( 7, -8 ) };
    for( Transformation t : ts ) {
      Region tr = t.apply( Circle.UNIT );
      for ( Point p : ps ) {
        assertEquals( Circle.UNIT.contains( p ), tr.contains( t.apply( p )) );
      }
View Full Code Here

Examples of uk.org.naptan.LocationStructure.Translation

    Place place = stopPoint.getPlace();
    Location location = place.getLocation();
    if (location.getLatitude() != null) {
      return location.getLatitude().doubleValue();
    }
    Translation translation = location.getTranslation();
    if (translation.getLatitude() != null) {
      return translation.getLatitude().doubleValue();
    }
    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.