Skip to content

Commit

Permalink
add zh_conversion.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoweibin committed Jul 8, 2011
1 parent 2df5ab3 commit 43d149d
Show file tree
Hide file tree
Showing 3 changed files with 21,127 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README
@@ -0,0 +1,3 @@
clone from "http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/ZhConversion.php?view=co"

I just reproduced a ruby hashtable.
34 changes: 32 additions & 2 deletions misc/zhtable/Makefile.py
Expand Up @@ -369,12 +369,43 @@ def main():
+ '\n);\n\n$zh2SG = array(\n' \
+ PHPArray( toSG ) \
+ '\n);'

f = open( 'ZhConversion.php', 'wb', encoding = 'utf8' )
print ('Writing ZhConversion.php ... ')
f.write( php )
f.close()

ruby = '''# encoding: utf-8
# Simplified / Traditional Chinese conversion tables
#
# Automatically generated using code and data in misc/zhtable/
# Do not modify directly!
if RUBY_VERSION < '1.9'
$KCODE = 'U'
require 'jcode'
end
ZH2TRADITIONAL = {\n'''
ruby += PHPArray( toHant ) \
+ '\n}\n\nZH2SIMPLIFIED = {\n' \
+ PHPArray( toHans ) \
+ '\n}\n\nZH2TW = {\n' \
+ PHPArray( toTW ) \
+ '\n}\n\nZH2HK = {\n' \
+ PHPArray( toHK ) \
+ '\n}\n\nZH2CN = {\n' \
+ PHPArray( toCN ) \
+ '\n}\n\nZH2SG = {\n' \
+ PHPArray( toSG ) \
+ '\n}'

f = open( 'zh_conversion.rb', 'wb', encoding = 'utf8' )
print ('Writing zh_conversion.rb ... ')
f.write( ruby )
f.close()

#Remove temp files
print ('Deleting temp files ... ')
os.remove('EZ-Big.txt.in')
Expand All @@ -383,7 +414,6 @@ def main():
os.remove('Unihan_Variants.txt')
os.remove('Wubi.txt.in')
os.remove('Ziranma.txt.in')


if __name__ == '__main__':
main()

0 comments on commit 43d149d

Please sign in to comment.