diff --git a/icu4j/src/com/ibm/icu/dev/tool/cldr/LDML2ICUConverter.java b/icu4j/src/com/ibm/icu/dev/tool/cldr/LDML2ICUConverter.java
index 989d2b095e0..aa80db87938 100644
--- a/icu4j/src/com/ibm/icu/dev/tool/cldr/LDML2ICUConverter.java
+++ b/icu4j/src/com/ibm/icu/dev/tool/cldr/LDML2ICUConverter.java
@@ -69,8 +69,8 @@ public class LDML2ICUConverter {
}
private void usage() {
- System.out.println("\nUsage: LDMLConverter [OPTIONS] [FILES]\n\n"+
- "This program is used to convert XLIFF files to ICU ResourceBundle TXT files.\n"+
+ System.out.println("\nUsage: LDML2ICUConverter [OPTIONS] [FILES]\n\n"+
+ "This program is used to convert LDML files to ICU ResourceBundle TXT files.\n"+
"Please refer to the following options. Options are not case sensitive.\n"+
"Options:\n"+
"-s or --sourcedir source directory for files followed by path, default is current directory.\n" +
@@ -133,14 +133,14 @@ public class LDML2ICUConverter {
* }
*/
// TODO : uncomment
- fullyResolved = LDMLUtilities.getFullyResolvedLDML(sourceDir, args[i], false, false);
+ fullyResolved = LDMLUtilities.getFullyResolvedLDML(sourceDir, args[i], false, false, false);
if(specialsDir!=null){
locName = args[i];
int index = locName.indexOf(".xml");
if(index > -1){
locName = locName.substring(0,index);
}
- fullyResolvedSpecials = LDMLUtilities.getFullyResolvedLDML(specialsDir, args[i], false, true);
+ fullyResolvedSpecials = LDMLUtilities.getFullyResolvedLDML(specialsDir, args[i], false, true, false);
/*
try{
OutputStreamWriter writer = new
@@ -2348,7 +2348,7 @@ public class LDML2ICUConverter {
* before & [before 1] x< [last variable] x
*/
/*
- * & [first tertiary ignorable] << à à
+ * & [first tertiary ignorable] << \u00e1 ?
*/
StringBuffer ret = new StringBuffer();
diff --git a/icu4j/src/com/ibm/icu/dev/tool/cldr/LDMLComparator.java b/icu4j/src/com/ibm/icu/dev/tool/cldr/LDMLComparator.java
index 12b9078fc03..becaa0517df 100644
--- a/icu4j/src/com/ibm/icu/dev/tool/cldr/LDMLComparator.java
+++ b/icu4j/src/com/ibm/icu/dev/tool/cldr/LDMLComparator.java
@@ -53,7 +53,8 @@ public class LDMLComparator {
private static final int OPT_DIFF = 0x4000; /*2exp15*/ //PN
private static final int OPT_DIFF_REF_COMMON = 0x8000; /*2exp16*/ //PN
private static final int OPT_BULK = 0x00010000; //PN
- private static final int OPT_UNKNOWN = 0x00020000; //2**17 PN
+ private static final int OPT_CASE_SENSITIVE = 0x00020000; //PN
+ private static final int OPT_UNKNOWN = 0x00040000;
private static final String COMMON = "common";
private static final String ICU = "icu";
@@ -72,6 +73,7 @@ public class LDMLComparator {
private static final String DIFF = "diff";
private static final String DIFF_REF_COMMON = "diff_ref_common";
private static final String BULK = "bulk";
+ private static final String CASE_SENSITIVE = "case_sensitive";
private static final String[] PLATFORM_PRINT_ORDER ={
COMMON,
ICU,
@@ -105,6 +107,7 @@ public class LDMLComparator {
"-" + DIFF, //PN added, indicates that only differing elements/attributes to be written to html
"-" + DIFF_REF_COMMON, //PN added, same as diff only common is excluded from diff but gets printed to html for reference purposes
"-" + BULK, //do a bulk comparison of folder contents
+ "-" + CASE_SENSITIVE, //do case sensitive matching (by default it's not case sensitive)
};
@@ -137,7 +140,7 @@ public class LDMLComparator {
private Vector m_PlatformVect = new Vector(); //holds names of platforms
private Vector m_PlatformFolderVect = new Vector(); //holds names of folders containing locale data for each platform
private int m_iOptions;
- // key = element id, data = AccumulateDifferences instance
+ // m_AccumulatedResultsMap key = element id (node+parentNode+type+index string), data = AccumulateDifferences instance
private TreeMap m_AccumulatedResultsMap = new TreeMap();
private int m_iTotalConflictingElements = 0;
private int m_iTotalNonConflictingElements = 0;
@@ -255,7 +258,8 @@ public class LDMLComparator {
" [-ibmtor] filename [-apple] filename" +
" [-sunjdk] filename [-open_office] filename" +
" [-aix] filename [-linux] filename" +
- " [-diff / -diff-ref-common] [-bulk]"
+ " [-diff / -diff_ref_common] [-bulk]" +
+ " [-case_sensitive (only active if -diff of -diff-ref-common option selected)]"
);
System.err.println("\nExample 1: \n " +
"LDMLComparator -solaris:gold foldername1 -sunjdk foldername2 -common foldername3 -diff-ref-common -bulk\n" +
@@ -311,6 +315,8 @@ public class LDMLComparator {
{
}
+ else if (USER_OPTIONS[i].equals("-" + CASE_SENSITIVE))
+ {}
else
{
if(!isGold)
@@ -444,10 +450,18 @@ public class LDMLComparator {
{
isEqual = true;
}
- //if case is different then the values are considered to be different
- // else if(Normalizer.compare(compareTo,value,Normalizer.COMPARE_IGNORE_CASE)==0)
- // {
- // }
+ else if(Normalizer.compare(compareTo,value,Normalizer.COMPARE_IGNORE_CASE)==0)
+ {
+ if ((m_iOptions & OPT_CASE_SENSITIVE) == 0)
+ { //it's not a case sensitive search so this is a match
+ isEqual = true;
+ }
+ else
+ {
+ isEqual = false;
+ break; //we have found a difference therefore break out of loop , we will print full row
+ }
+ }
else
{
isEqual = false;
@@ -523,10 +537,27 @@ public class LDMLComparator {
{
isEqual = true;
}
- //if case is different then the values are considered to be different
- // else if(Normalizer.compare(compareTo,value,Normalizer.COMPARE_IGNORE_CASE)==0)
- // {
- // }
+ else if(Normalizer.compare(compareTo,value,Normalizer.COMPARE_IGNORE_CASE)==0)
+ {
+ //case difference on date and time format doesn't matter
+ if ((element.parentNode.compareTo("timeFormat")==0)
+ || (element.parentNode.compareTo("dateFormat")==0))
+ {
+ isEqual = true;
+ }
+ else
+ {
+ if ((m_iOptions & OPT_CASE_SENSITIVE) == 0)
+ { //it's not a case sensitive search so this is a match
+ isEqual = true;
+ }
+ else
+ {
+ isEqual = false;
+ break; //we have found a difference therefore break out of loop , we will print full row
+ }
+ }
+ }
else
{
isEqual = false;
@@ -724,7 +755,7 @@ public class LDMLComparator {
String locale = fileName.substring(index+1, fileName.lastIndexOf("."));
System.out.println("INFO: Creating fully resolved tree for : " + fileName);
- Document doc = LDMLUtilities.getFullyResolvedLDML(sourceDir, locale, true, true);
+ Document doc = LDMLUtilities.getFullyResolvedLDML(sourceDir, locale, true, true, true);
/*
* debugging code
*
@@ -1302,7 +1333,8 @@ public class LDMLComparator {
//PN added
private void AddToAccumulatedResultsMap(String id, CompareElement element, String locale, boolean bIsEqual)
{
-
+ if (element == null)
+ return;
Object obj = m_AccumulatedResultsMap.get(id);
AccumulatedResults ad;
@@ -1329,8 +1361,8 @@ public class LDMLComparator {
ad = (AccumulatedResults) obj;
if((!ad.index.equals(element.index)) ||
(!ad.node.equals(element.node)) ||
- (!ad.parentNode.equals(element.parentNode)) ||
- (!ad.type.equals(element.type)))
+ (!ad.parentNode.equals(element.parentNode))) // ||
+ // (!ad.type.equals(element.type))) type can be null so don't ceck its value
{
throw new RuntimeException("The retrieved object is not the same as the one trying to be saved");
}
@@ -1360,12 +1392,11 @@ public class LDMLComparator {
writer.print( " \n" +
" N. | \n"+
" ParentNode | \n"+
- " Type | \n"+
" Name | \n"+
" ID | \n" +
" # of non-conflicting locales | " +
" # of conflicting locales | " +
- " Locales where conflicts were found | " +
+ " Locales where conflicts were found | " +
"
\n");
// walk down the cm_AccumulateDifferenceMap and print the data
@@ -1395,7 +1426,6 @@ public class LDMLComparator {
writer.print(" \n");
writer.print(" "+(iCounter++)+" | \n");
writer.print(" "+ad.parentNode+" | \n");
- writer.print(" "+ad.type+" | \n");
writer.print(" "+ad.node+" | \n");
writer.print(" "+ad.index+" | \n");
writer.print(" "+ad.localeVectSame.size()+" | \n");
diff --git a/icu4j/src/com/ibm/icu/dev/tool/cldr/LDMLUtilities.java b/icu4j/src/com/ibm/icu/dev/tool/cldr/LDMLUtilities.java
index 2bd5125aa31..b1a02983ccc 100644
--- a/icu4j/src/com/ibm/icu/dev/tool/cldr/LDMLUtilities.java
+++ b/icu4j/src/com/ibm/icu/dev/tool/cldr/LDMLUtilities.java
@@ -51,7 +51,9 @@ public class LDMLUtilities {
* @param locale
* @return
*/
- public static Document getFullyResolvedLDML(String sourceDir, String locale, boolean ignoreRoot, boolean ignoreUnavailable){
+ public static Document getFullyResolvedLDML(String sourceDir, String locale,
+ boolean ignoreRoot, boolean ignoreUnavailable,
+ boolean ignoreIfNoneAvailable){
Document full =null;
try{
full = parse(sourceDir+File.separator+ "root.xml");
@@ -74,6 +76,7 @@ public class LDMLUtilities {
}
String[] constituents = locale.split("_");
String loc=null;
+ boolean isAvailable = false;
for(int i=0; i