Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils/merge-po.py
blob: 84b2b157d1b1a4cb85af062a999cdf0f8f613602 (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
25
26
27
28
29
30
31
32
import os, polib

FROM  = 'ceibal-fr'
TO    = 'ceibal'

po_from = polib.pofile(os.path.join('tmp', '%s.po' % FROM))
po_to   = polib.pofile(os.path.join('tmp', '%s.po' % TO))

po_out  = polib.POFile()
po_out.metadata = {
    'Project-Id-Version': 'PACKAGE VERSION',
    'Report-Msgid-Bugs-To': '',
    'POT-Creation-Date': '2012-04-14 14:55+0200',
    'PO-Revision-Date': '2012-04-14 15:10+0200',
    'Last-Translator': 'florent <iflo_8@yahoo.fr>',
    'Language-Team': 'LANGUAGE <LL@li.org>',
    'Language': 'fr',
    'MIME-Version': '1.0',
    'Content-Type': 'text/plain; charset=UTF-8',
    'Content-Transfer-Encoding': '8bit',
    'X-Generator': 'Pootle 2.2.0-alpha1a',
    'X-POOTLE-MTIME': '1334409010.284015',
}

for e_to in po_to:
    for e_from in po_from:
        if e_to.msgid == e_from.msgid:
            e_to.msgstr = e_from.msgstr
            break
    po_out.append(e_to)

po_out.save(os.path.join('tmp', '%s.po' % TO))