Skip to content

Commit

Permalink
Shift DumpLocale to generate code using u()
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddrysdale committed Nov 27, 2011
1 parent 562715f commit b4e6759
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions python/DumpLocale.java
Expand Up @@ -9,15 +9,10 @@
class DumpLocale {
private static final char SINGLE_QUOTE = 39;
private static final char[] hexChar = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
private static boolean python3 = false;

/* Print a Unicode name suitably escaped */
private static void printName(String name) {
if (python3) {
System.out.print("'");
} else {
System.out.print("u'");
}
System.out.print("u('");
// Need to escape unicode data
for (int ii=0; ii<name.length(); ii++) {
char c = name.charAt(ii);
Expand All @@ -36,7 +31,7 @@ private static void printName(String name) {
System.out.print(hexChar[c & 0xF]);
}
}
System.out.print("'");
System.out.print("')");
}

private static void printProperty(String propName) {
Expand All @@ -60,6 +55,7 @@ private static void printProlog() {
System.out.println("");
System.out.println("Auto-generated file, do not edit by hand.");
System.out.println("\"\"\"");
System.out.println("from ..util import u");
}

public static void main(String[] args) {
Expand Down

0 comments on commit b4e6759

Please sign in to comment.