Skip to content

Instantly share code, notes, and snippets.

@saiten
Created August 12, 2011 02:51
Show Gist options
  • Save saiten/1141339 to your computer and use it in GitHub Desktop.
Save saiten/1141339 to your computer and use it in GitHub Desktop.
%1$d,%2$dみたいな置換文字列に対応させる
*** localecompiler.py.orig 2011-08-12 11:43:31.000000000 +0900
--- localecompiler.py 2011-08-12 11:44:00.000000000 +0900
***************
*** 72,77 ****
--- 72,79 ----
pass
value = self.getText(node.childNodes)
# TODO: translate any more symbols?
+ value = re.sub(r'%(\d+)\$d', r'%\1$.0f', value)
+ value = re.sub(r'%(\d+)\$s', r'%\1$@', value)
value = value.replace("%s",'%@')
f.write(u'"%s" = "%s";\n' % (name,value))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment