1 15 package org.apache.hivemind.util; 16 17 import java.io.File ; 18 import java.util.Locale ; 19 20 21 27 public class LocalizedFileResourceFinder 28 { 29 public String findLocalizedPath(String path, Locale locale) 30 { 31 int dotx = path.lastIndexOf('.'); 32 String basePath; 33 String suffix; 34 if (dotx >= 0) 35 { 36 basePath = path.substring(0, dotx); 37 suffix = path.substring(dotx); 38 } 39 else 40 { 41 basePath = path; 43 suffix = ""; 44 } 45 LocalizedNameGenerator g = new LocalizedNameGenerator(basePath, locale, suffix); 46 47 while (g.more()) 48 { 49 String candidate = g.next(); 50 51 File f = new File (candidate); 52 53 if (f.exists()) 54 return candidate; 55 } 56 57 return path; 58 } 59 } 60 | Popular Tags |