@Test public void testGetBaseVersion() { assertEquals("test.jsp", LanguageUtils.getBaseVersion("test_en.jsp")); try { LanguageUtils.getBaseVersion("test_xyz.jsp"); fail("LanguageSupport failed when presented with by non existent language xyz"); } catch (UnknownLanguageException e) { } }
public static String getBaseVersion(String s) { Language l = extractLanguage(s); if (l == null) { return s; } int languagePos = s.indexOf("_" + l.getIdentifier()); String original = s.substring(0, languagePos); if (s.length() > languagePos + 3) { String suffix = s.substring(languagePos + 3); original += suffix; } return original; }
LanguageUtils { public static String getBaseVersion(String s) { Language l = extractLanguage(s); if (l == null) { return s; } int languagePos = s.indexOf("_" + l.getIdentifier()); String original = s.substring(0, languagePos); if (s.length() > languagePos + 3) { String suffix = s.substring(languagePos + 3); original += suffix; } return original; } }
LanguageUtils { public static String getBaseVersion(String s) { Language l = extractLanguage(s); if (l == null) { return s; } int languagePos = s.indexOf("_" + l.getIdentifier()); String original = s.substring(0, languagePos); if (s.length() > languagePos + 3) { String suffix = s.substring(languagePos + 3); original += suffix; } return original; } private  LanguageUtils(); }
LanguageUtils { public static String getBaseVersion(String s) { Language l = extractLanguage(s); if (l == null) { return s; } int languagePos = s.indexOf("_" + l.getIdentifier()); String original = s.substring(0, languagePos); if (s.length() > languagePos + 3) { String suffix = s.substring(languagePos + 3); original += suffix; } return original; } private  LanguageUtils(); static Language getLanguage(Locale locale); static Language getLanguage(String languageCode); static LocalizableContent<String> addDescriptions(Node configuration,
      String tagName, Language defaultLanguage, LocalizableContent<String> o,
      boolean escape); static LocalizableContent<String> addDescriptions(Node configuration,
      String tagName, Language defaultLanguage, LocalizableContent<String> o,
      boolean escape, XPath xpath); static String getLanguageVariant(String s, Language language); static String[] getLanguageVariants(String s, Language... languages); static String getBaseVersion(String s); static Language extractLanguage(String s); static Language getPreferredLanguage(Set<Language> choices,
      HttpServletRequest request); static Language getPreferredLanguage(Localizable localizable,
      HttpServletRequest request, Site site); static Language getPreferredContentLanguage(Resource<?> resource,
      HttpServletRequest request, Site site); static Language getPreferredLanguage(HttpServletRequest request,
      Site site); static Language getPreferredLanguage(Localizable localizable,
      Language... languages); static Language getPreferredContentLanguage(Resource<?> resource,
      Language... languages); }
LanguageUtils { public static String getBaseVersion(String s) { Language l = extractLanguage(s); if (l == null) { return s; } int languagePos = s.indexOf("_" + l.getIdentifier()); String original = s.substring(0, languagePos); if (s.length() > languagePos + 3) { String suffix = s.substring(languagePos + 3); original += suffix; } return original; } private  LanguageUtils(); static Language getLanguage(Locale locale); static Language getLanguage(String languageCode); static LocalizableContent<String> addDescriptions(Node configuration,
      String tagName, Language defaultLanguage, LocalizableContent<String> o,
      boolean escape); static LocalizableContent<String> addDescriptions(Node configuration,
      String tagName, Language defaultLanguage, LocalizableContent<String> o,
      boolean escape, XPath xpath); static String getLanguageVariant(String s, Language language); static String[] getLanguageVariants(String s, Language... languages); static String getBaseVersion(String s); static Language extractLanguage(String s); static Language getPreferredLanguage(Set<Language> choices,
      HttpServletRequest request); static Language getPreferredLanguage(Localizable localizable,
      HttpServletRequest request, Site site); static Language getPreferredContentLanguage(Resource<?> resource,
      HttpServletRequest request, Site site); static Language getPreferredLanguage(HttpServletRequest request,
      Site site); static Language getPreferredLanguage(Localizable localizable,
      Language... languages); static Language getPreferredContentLanguage(Resource<?> resource,
      Language... languages);  }