-
-
Save rouuuge/bd2fa6e71d58bc06174f9d5b6e76a58e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import io | |
from xml.dom import minidom | |
xmldoc = minidom.parse('values-ru/strings.xml') | |
itemlist = xmldoc.getElementsByTagName('string') | |
with io.open('app_ru.arb', 'w', encoding='utf8') as out_file: | |
out_file.write('{'.decode('utf-8')) | |
for s in itemlist: | |
if (s.firstChild != None): | |
out_file.write('"'.decode('utf-8')) | |
out_file.write(s.getAttribute("name").decode('utf-8')) | |
out_file.write('"'.decode('utf-8')) | |
out_file.write(": ".decode('utf-8')) | |
out_file.write('"'.decode('utf-8')) | |
out_file.write(s.firstChild.data.encode('utf-8').decode('utf-8')) | |
out_file.write('"'.decode('utf-8')) | |
out_file.write(','.decode('utf-8')) | |
out_file.write('\n'.decode('utf-8')) | |
else: | |
out_file.write(''.decode('utf-8')) | |
out_file.write('}'.decode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment