1 8 package org.apache.avalon.excalibur.i18n; 9 10 import java.util.Locale ; 11 12 19 20 public class DirectoryMapper extends DefaultMapper { 21 22 27 public String map(BundleInfo bundleInfo) { 28 String name = bundleInfo.getName(); 29 Locale loc = bundleInfo.getLocale(); 30 StringBuffer sb = new StringBuffer (getPrefix()); 31 if (loc != null) { 32 String lang = loc.getLanguage(); 33 String country = loc.getCountry(); 34 String variant = loc.getVariant(); 35 36 if (lang.length() > 0) sb.append("/").append(lang); 37 if (country.length() > 0) sb.append("/").append(country); 38 if (variant.length() > 0) sb.append("/").append(variant); 39 } 40 sb.append("/").append(name).append(getSuffix()); 41 42 String result = sb.toString(); 43 return result; 44 } 45 46 } 47 | Popular Tags |