Merge pull request #49 from MightyCreak/fix-translations
Update all translation files
This commit is contained in:
commit
3a6e9f188b
|
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- added .editorconfig file
|
||||
- added .gitignore file
|
||||
- added message when removing files during uninstallation
|
||||
- added Python script to update all the translation files at once
|
||||
|
||||
### Changed
|
||||
- convert to Python 3
|
||||
|
@ -23,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- updated copyrights years and authors
|
||||
- improve Spanish translation
|
||||
- convert translation README to MarkDown
|
||||
- updated all the translation files
|
||||
|
||||
### Fixed
|
||||
- fixed wrong icons directory for gtk-update-icon-cache
|
||||
|
|
|
@ -66,8 +66,8 @@ _ = gettext.gettext
|
|||
|
||||
APP_NAME = 'Diffuse'
|
||||
VERSION = '0.5.0'
|
||||
COPYRIGHT = _('''Copyright © 2006-2019 Derrick Moser
|
||||
Copyright © 2015-2020 Romain Failliot''')
|
||||
COPYRIGHT = '''{copyright} © 2006-2019 Derrick Moser
|
||||
{copyright} © 2015-2020 Romain Failliot'''.format(copyright=_("Copyright"))
|
||||
WEBSITE = 'https://github.com/MightyCreak/diffuse'
|
||||
|
||||
# process help options
|
||||
|
@ -6810,8 +6810,8 @@ class AboutDialog(Gtk.AboutDialog):
|
|||
self.set_comments(_('Diffuse is a graphical tool for merging and comparing text files.'))
|
||||
self.set_copyright(COPYRIGHT)
|
||||
self.set_website(WEBSITE)
|
||||
self.set_authors([ _('Derrick Moser <derrick_moser@yahoo.com>'),
|
||||
_('Romain Failliot <romain.failliot@foolstep.com>') ])
|
||||
self.set_authors([ 'Derrick Moser <derrick_moser@yahoo.com>',
|
||||
'Romain Failliot <romain.failliot@foolstep.com>' ])
|
||||
self.set_translator_credits(_('translator-credits'))
|
||||
ss = [ APP_NAME + ' ' + VERSION + '\n',
|
||||
COPYRIGHT + '\n\n',
|
||||
|
|
1578
translations/cs.po
1578
translations/cs.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1557
translations/pt.po
1557
translations/pt.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1526
translations/th.po
1526
translations/th.po
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2020 Romain Failliot <romain.failliot@foolstep.com>
|
||||
#
|
||||
# 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 2 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. You may also obtain a copy of the GNU General Public License
|
||||
# from the Free Software Foundation by visiting their web site
|
||||
# (http://www.fsf.org/) or by writing to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
def generate_pot_file():
|
||||
subprocess.run(["xgettext", "-s", "-o", "diffuse.pot", "-L", "Python", "../src/usr/bin/diffuse"])
|
||||
|
||||
def update_translation(filename):
|
||||
print(f"Updating translation file '{filename}'...")
|
||||
|
||||
# Get language
|
||||
lang = os.path.splitext(filename)[0]
|
||||
|
||||
# Move existing .po file to working directory
|
||||
tmpfile = os.path.join(tmpdir, filename)
|
||||
shutil.move(filename, tmpfile)
|
||||
|
||||
# Create a new .po file for this language
|
||||
emptypofile = os.path.join(tmpdir, f"{lang}.empty.po")
|
||||
subprocess.run(["msginit", "--no-wrap", "--no-translator", "-l", lang, "-o", emptypofile, "-i", "diffuse.pot"])
|
||||
|
||||
# Merge with the old translation
|
||||
subprocess.run(["msgmerge", "-q", "--no-wrap", tmpfile, emptypofile, "-o", filename])
|
||||
|
||||
# Validate translation
|
||||
print(f"Validation:")
|
||||
subprocess.run(["msgfmt", "-c", "-v", filename])
|
||||
|
||||
print(f"Update done.")
|
||||
|
||||
# Generate diffuse.pot file
|
||||
generate_pot_file()
|
||||
|
||||
# Create temporary working directory
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
|
||||
try:
|
||||
# Update PO files
|
||||
po_files = glob.glob("*.po", recursive=False)
|
||||
po_files.sort()
|
||||
for file in po_files:
|
||||
update_translation(file)
|
||||
finally:
|
||||
# Remove working directory
|
||||
shutil.rmtree(tmpdir)
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue