4 base_language_hash = Hash::new
5 target_language_hash = Hash::new
6 comment_hash = Hash::new
9 open($*[0], "rb:UTF-16LE:UTF-8") do |f|
11 pattern = '^"(\d*)\..*" = "(.*)";$'
12 r = Regexp.new(pattern, Regexp::FIXEDENCODING)
15 base_language_hash.store(key, m[2])
19 # Open target language
20 open($*[1], "rb:UTF-16LE:UTF-8") do |f|
22 pattern = '^\/\* Class = "(.*)"; .* = "(.*)"; ObjectID = "(.*)"; \*\/$'
23 r = Regexp.new(pattern, Regexp::FIXEDENCODING)
27 unless translation.strip.length == 0 or base_language_hash[key].eql?("OtherViews")
28 target_language_hash.store(key, translation)
29 comment_hash.store(key, "/* %s (%s) : <title:%s> (oid:%s) */" % [m[1], translation, translation, key])
35 # Write Byte Order Mark
36 print "\uFEFF".encode("UTF-16LE")
38 target_language_hash.each { |key, value|
39 comment = comment_hash[key]
40 base = base_language_hash[key]
41 output = "%s\n\"%s\" = \"%s\";\n\n" % [comment, base, value]
42 print output.encode("UTF-16LE")