Package org.apache.rave.portal.model.util

Examples of org.apache.rave.portal.model.util.LocalizedString


  @Test
  public void testGetLocalizedElement() {
    // This should be independent of the actual build locale.
    LocalizedString[] elements = new LocalizedString[3];
    elements[0] = new LocalizedString("Hello World", "en");
    elements[1] = new LocalizedString("你好世界", "cn");
    elements[2] = new LocalizedString("Nom de plume!", "fr");
    LocalizedString testMatch = new LocalizedString("Nom de plume!", "fr");
    String[] locales = { "es", "fr", "en" };
    LocalizedString bestMatch = LocalizationUtils.getLocalizedElement(
        elements, locales);
    assertTrue("Localized element best match returned correctly",bestMatch.getValue().equals(testMatch.getValue()));
  }
View Full Code Here


    assertNotNull("Locales array is not null", locales);

    // Set up a dummy list of strings. Last one will be the
    // correct one.
    LocalizedString[] elements = new LocalizedString[4];
    elements[0] = new LocalizedString("Hollow World", locales.get(0)
        .toLanguageTag());
    elements[1] = new LocalizedString("Hello World", "xx-xx");
    elements[2] = new LocalizedString("你好世界", "xy-xx");
    elements[3] = new LocalizedString("Nom de plume!", "xz-xx");

    // Sort and test
    LocalizedString[] sortedElements = LocalizationUtils
        .processElementsByDefaultLocales(elements);
    assertNotNull("Sorted elements list is not null", sortedElements);
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.util.LocalizedString

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.