Commit b5d125b8 authored by Pino Toscano's avatar Pino Toscano Committed by Claude Paroz

Do not error out on pot files with no messages

language is None for them, so skip all the extra processing that really
applies only to po files.
parent 1438e9ed
Pipeline #79902 failed with stage
in 1 minute and 17 seconds
......@@ -1503,7 +1503,7 @@ class Statistics(models.Model):
# If stats are 100%, compare the total number of strings between
# committed po (pofile) and merged po (outpo).
# Until https://savannah.gnu.org/bugs/index.php?50910 is fixed.
if stats['fuzzy'] + stats['untranslated'] == 0: # Fully translated
if self.language and stats['fuzzy'] + stats['untranslated'] == 0: # Fully translated po file
abs_po_path = self.branch.co_path / self.domain.get_po_path(self.language.locale)
if abs_po_path.exists():
git_stats = utils.po_file_stats(abs_po_path)
......
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gedit/issues\n"
"POT-Creation-Date: 2019-03-17 23:29+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
......@@ -740,6 +740,20 @@ class StatisticsTests(TestCase):
]
self.assertEqual(sorted(infos)[0].statistics.branch.module.name, 'gnome-hello')
def test_empty_pot(self):
pot_file = Path(__file__).parent / 'empty.pot'
mod = Module.objects.get(name='zenity')
dom = Domain.objects.create(
module=mod, name='po2', dtype='ui', description='UI Translations'
)
branch = mod.branch_set.get(name='gnome-3-8')
stat = Statistics.objects.create(branch=branch, domain=dom, language=None)
stat.update_stats(pot_file)
self.assertEqual(stat.full_po, stat.part_po)
self.assertEqual(stat.translated(), 0)
self.assertEqual(stat.fuzzy(), 0)
self.assertEqual(stat.untranslated(), 0)
class FigureTests(TestCase):
fixtures = ['sample_data.json']
def test_figure_view(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment