Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils/sphinx-to-po.py
blob: 77ffac74094e8fdc42ccf698f416f5752bea270f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import codecs, os, subprocess

SRC = [
    'index',
    'credits',
    'summary',
    'prolog',
    ]
    
OUT = 'ceibal'

FILE_SEP = '\n\n\n^-^_^-^_^-^_^-^_^-^_^-^_^-^_^-^_\n\n\n'

path_out_txt = os.path.join('tmp', '%s.txt' % OUT)
with codecs.open(path_out_txt, 'wb', 'utf-8') as file_po:
    for name in SRC:
        path_src = os.path.join('source', 'es', '%s.rst' % name)
        with codecs.open(path_src, 'rb', 'utf-8') as file_src:
            file_po.write(file_src.read())
            file_po.write(FILE_SEP)

path_out_po = os.path.join('tmp', '%s.po' % OUT)
subprocess.call('txt2po --encoding utf-8 %s %s' % (path_out_txt, path_out_po),
                shell=True)