1 20 package org.enhydra.barracuda.taskdefs; 21 22 import java.io.File ; 23 import java.util.StringTokenizer ; 24 import java.util.Arrays ; 25 import org.enhydra.xml.xmlc.taskdef.*; 26 27 28 34 public class LocalizeXmlcUtilsImpl extends DefaultXmlcUtilsImpl { 35 36 40 48 public LocalizeXmlcUtilsImpl() { 49 super(); 50 } 51 52 56 72 public String buildClassName(String theFullBaseFileName, 73 String theModifier) { 74 String baseFileName = theFullBaseFileName; 76 String localeStr = ""; 77 78 if (theFullBaseFileName.indexOf("_")>0) { 82 int offset = 0; 83 String tfile = theFullBaseFileName; 84 StringTokenizer st = new StringTokenizer (tfile, "_"); 85 while (st.hasMoreTokens()) { 86 String token = st.nextToken(); 87 int pos = Arrays.binarySearch(Localize.countryCodes, token); 88 if (pos>-1 && pos<Localize.countryCodes.length && Localize.countryCodes[pos].equals(token)) break; 89 else offset += token.length()+1; 90 } 91 if (offset<baseFileName.length()) { 92 baseFileName = theFullBaseFileName.substring(0,offset-1); 93 localeStr = theFullBaseFileName.substring(offset-1); 94 } 95 } 97 98 String className = baseFileName.replace('/', '.'); 99 className = className.replace(File.separatorChar, '.') + theModifier + localeStr; 100 return className; 101 } 102 103 } 104 | Popular Tags |