MultiWebApplicationPath { String getShopResourceFile(final String pathname) { int filenamePos = pathname.lastIndexOf('/'); if (filenamePos == -1) { filenamePos = 0; } int localePos = pathname.substring(filenamePos).indexOf('_'); if (localePos == -1) { localePos = pathname.length() - RESOURCE_EXTENSION.length() - 1; } else { localePos += filenamePos; } return "shop" + pathname.substring(localePos); } MultiWebApplicationPath(final ServletContext servletContext); void add(String path); IResourceStream find(final Class<?> clazz, final String pathname); @Override String toString();  }
@Test public void testGetShopResourceFile() throws Exception { assertEquals("shop.properties.xml", new MultiWebApplicationPath(null).getShopResourceFile("some/path/HomePage.properties.xml")); assertEquals("shop_en.properties.xml", new MultiWebApplicationPath(null).getShopResourceFile("some/path/HomePage_en.properties.xml")); assertEquals("shop_en_US.properties.xml", new MultiWebApplicationPath(null).getShopResourceFile("some/path/HomePage_en_US.properties.xml")); }