← Back to team overview

openerp-hungarian-team team mailing list archive

Re: fordítások

 

%2011. január 20. 13:10:01 dátummal Ön az alábbiakat írta:
> Az lenne a kérdésem, hogy van arra valami mód, hogy mondjuk
> összehasonlítsam az én korábbi fordításommal az övékét. Tehát pl az ő
> account modulhoz tartozó po fájlját az én account po-mal? Mert soronként
> végig bogarászni, elég macerás...

Biztos van rá jobb mód is, de ha nem találsz mást, összedobtam egy kis 
scriptet erre a célra. Csatoltam az e-mailhez. Kell hozzá a 
http://pypi.python.org/pypi/polib


üdv,
Gábor
#!/usr/bin/python
# -*- encoding: utf-8 -*-
##############################################################################
#
#    Copyright (C) 2010 Gábor Dukai <gdukai@xxxxxxxxx>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from optparse import OptionParser
import polib
parser = OptionParser("usage: %prog [options] arg1 arg2")
parser.add_option("-f", "--file", dest="filename",
                  help="write report to FILE", metavar="FILE")
(options, args) = parser.parse_args()
if len(args) != 2:
    parser.error("incorrect number of arguments")
po1 = polib.pofile(args[0])
po2 = polib.pofile(args[1])
if options.filename:
    outfile = open(options.filename, 'w')
for entry in po1:
    if entry.msgstr:
        entry2 = None
        for e2 in po2:
            if e2.msgid == entry.msgid:
                entry2 = e2
        if entry2 and entry.msgstr == entry2.msgstr:
            continue
        out = entry.msgid + '\n'
        out += entry.msgstr + '\n'
        out += entry2.msgstr if entry2 else ''
        out += '\n'
        out += '----------------'
        if options.filename:
            outfile.write(out.encode('utf-8'))
            outfile.write('\n')
        else:
            print out
if options.filename:
    outfile.close()

Follow ups