Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Slightly improved python i18n. This gets rid of latin accents (fixes …

…NO, FR etc), but symbolic characters are still there....
  • Loading branch information...
commit d98bf81f19bd3e1f5a3976a5a869ec4b508e8ffa 1 parent 472998e
Aslak Hellesøy authored
14  jython/src/main/code_generator/I18n.jython.txt
... ...
@@ -1,4 +1,10 @@
1  
-class ${i18n.codeKeywords[0]}(object):
  1
+<% 
  2
+import java.text.Normalizer
  3
+def keywords = i18n.codeKeywords.collect { kw ->
  4
+  Normalizer.normalize(kw,  Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "")
  5
+}.unique()
  6
+%>
  7
+class ${keywords[0]}(object):
2 8
   def __init__(self, regexp):
3 9
     self.regexp = regexp
4 10
     
@@ -6,7 +12,5 @@ class ${i18n.codeKeywords[0]}(object):
6 12
     arity = func.func_code.co_argcount - 1
7 13
     backend.registerStepdef(StepDefinition(self.regexp, func), arity)
8 14
     return func
9  
-<% def str = "" %>
10  
-<% i18n.codeKeywords.each { kw -> %><% if (kw != i18n.codeKeywords[0]) str = str + kw + " = " %><% } %>
11  
-<% str = str + i18n.codeKeywords[0] %>
12  
-${str}
  15
+
  16
+${keywords.reverse().join(" = ")}

0 notes on commit d98bf81

Please sign in to comment.
Something went wrong with that request. Please try again.