[Debian-l10n-commits] translate-toolkit branch master updated. debian/2.0.0-1

Stuart Prescott stuart at moszumanska.debian.org
Mon Feb 27 11:57:06 UTC 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "translate-toolkit".

The branch, master has been updated
       via  3daec1b2e8153aa38a301357c3cd8d5ba4785b98 (commit)
       via  f46405d0397c6d0ec5b57c124bdf04f3d0e1fa0b (commit)
       via  1f49a95c0882dfd97c99cc2148fe1b4ebc7bb672 (commit)
      from  b5f15e51f8a6e445a8344bc5e24d663cf50237da (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------

http://anonscm.debian.org/gitweb/?p=debian-l10n/translate-toolkit.git;a=commitdiff;h=3daec1b2e8153aa38a301357c3cd8d5ba4785b98

commit 3daec1b2e8153aa38a301357c3cd8d5ba4785b98
Author: Stuart Prescott <stuart at debian.org>
Date:   Sat Feb 18 23:51:21 2017 +1100

    Add changelog for upload


http://anonscm.debian.org/gitweb/?p=debian-l10n/translate-toolkit.git;a=commitdiff;h=f46405d0397c6d0ec5b57c124bdf04f3d0e1fa0b

commit f46405d0397c6d0ec5b57c124bdf04f3d0e1fa0b
Merge: b5f15e5 1f49a95
Author: Stuart Prescott <stuart at debian.org>
Date:   Sat Feb 18 23:44:29 2017 +1100

    Merge tag 'upstream/2.0.0'
    
    Upstream version 2.0.0
    
    # gpg: Signature made Sat 18 Feb 2017 23:44:23 AEDT
    # gpg:                using RSA key BBC17EBB1396F2F7
    # gpg: Good signature from "Stuart Prescott <stuart at nanonanonano.net>"
    # gpg:                 aka "Stuart Prescott <stuart+debian at nanonanonano.net>"
    # gpg:                 aka "Stuart Prescott <stuart at debian.org>"

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                                   |  6 ++++
 docs/conf.py                                       |  2 +-
 docs/developers/releasing.rst                      |  4 +--
 docs/releases/{2.0.0rc3.rst => 2.0.0.rst}          | 22 ++++++++----
 docs/releases/index.rst                            |  1 +
 tests/cli/data/test_po2txt/one.po                  | 13 ++++++++
 tests/cli/data/test_po2txt/out.txt                 |  7 ++++
 tests/cli/data/test_po2txt_threshold/one.po        | 13 ++++++++
 tests/cli/data/test_po2txt_threshold/out.txt       |  0
 tests/cli/data/test_pofilter_manpage/stdout.txt    |  2 +-
 ...{test_pocount_nonexistant.sh => test_po2txt.sh} |  2 +-
 tests/cli/test_po2txt_threshold.sh                 |  7 ++++
 translate/__version__.py                           |  6 ++--
 translate/convert/convert.py                       | 15 +++++----
 translate/storage/mozilla_lang.py                  | 14 +++++---
 translate/storage/test_mozilla_lang.py             | 39 ++++++++++++++++++++++
 16 files changed, 128 insertions(+), 25 deletions(-)
 copy docs/releases/{2.0.0rc3.rst => 2.0.0.rst} (94%)
 create mode 100644 tests/cli/data/test_po2txt/one.po
 create mode 100644 tests/cli/data/test_po2txt/out.txt
 create mode 100644 tests/cli/data/test_po2txt_threshold/one.po
 create mode 100644 tests/cli/data/test_po2txt_threshold/out.txt
 copy tests/cli/{test_pocount_nonexistant.sh => test_po2txt.sh} (64%)
 create mode 100755 tests/cli/test_po2txt_threshold.sh

diff --git a/debian/changelog b/debian/changelog
index a5ad9cc..e9e9f98 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+translate-toolkit (2.0.0-1) unstable; urgency=medium
+
+  * New upstream release.
+
+ -- Stuart Prescott <stuart at debian.org>  Sun, 26 Feb 2017 23:39:30 +1100
+
 translate-toolkit (2.0.0~rc3-1) unstable; urgency=medium
 
   * New upstream release candidate.
diff --git a/docs/conf.py b/docs/conf.py
index e0f7006..a9802dd 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -67,7 +67,7 @@ copyright = u'2002-2017, Translate'
 # The short X.Y version.
 version = '2.0.0'
 # The full version, including alpha/beta/rc tags.
-release = '2.0.0rc3'
+release = '2.0.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/docs/developers/releasing.rst b/docs/developers/releasing.rst
index 28e4e59..c6a4d16 100644
--- a/docs/developers/releasing.rst
+++ b/docs/developers/releasing.rst
@@ -136,7 +136,7 @@ checkout run:
 .. code-block:: console
 
     $ mkvirtualenv build-ttk-release
-    (build-ttk-release)$ pip install --upgrade pip
+    (build-ttk-release)$ pip install --upgrade setuptools pip
     (build-ttk-release)$ pip install -r requirements/dev.txt
     (build-ttk-release)$ make build
     (build-ttk-release)$ deactivate
@@ -159,7 +159,7 @@ the new release using:
 .. code-block:: console
 
     $ mkvirtualenv test-ttk-release
-    (test-ttk-release)$ pip install --upgrade pip
+    (test-ttk-release)$ pip install --upgrade setuptools pip
     (test-ttk-release)$ pip install dist/translate-toolkit-$version.tar.bz2
 
 
diff --git a/docs/releases/2.0.0rc3.rst b/docs/releases/2.0.0.rst
similarity index 94%
copy from docs/releases/2.0.0rc3.rst
copy to docs/releases/2.0.0.rst
index 4483e5e..9cf2b25 100644
--- a/docs/releases/2.0.0rc3.rst
+++ b/docs/releases/2.0.0.rst
@@ -1,7 +1,7 @@
-Translate Toolkit 2.0.0rc3
-**************************
+Translate Toolkit 2.0.0
+***********************
 
-*Released on 23 January 2017*
+*Released on 27 January 2017*
 
 This release contains many improvements and bug fixes. While it contains many
 general improvements, it also specifically contains needed changes and
@@ -9,11 +9,13 @@ optimizations for the upcoming `Pootle <http://pootle.translatehouse.org/>`_
 2.8.0 and `Virtaal <http://virtaal.translatehouse.org>`_ releases.
 
 
-2.0.0rc3 vs 2.0.0rc2
-====================
+2.0.0 vs 2.0.0rc3
+=================
 
-- Added ``--removeuntranslated`` option to :doc:`po2json </commands/json2po>`
-- Unaccepted ASCII control characters are now escaped in XLIFF
+- :doc:`po2txt </commands/txt2po>` works correctly again when ``--threshold``
+  option is passed (:issue:`3499`)
+- Minor fixes for Mozilla .lang format
+- Minor Python 3 fix
 
 
 Major changes
@@ -79,6 +81,7 @@ Formats and Converters
   - ``{ok}`` marker is now more cleanly removed
   - Always output last unit followed by trailing newlines
   - Added support for headers and tag comments
+  - ``MAX_LENGTH`` is now parsed into comment
   - File line endings are now remembered, defaulting to Unix LF
 
 - Mozilla's l20n
@@ -116,6 +119,11 @@ Formats and Converters
 
   - YAML format support has been added.
 
+- txt
+
+  - :doc:`po2txt </commands/txt2po>` works correctly again when ``--threshold``
+    option is passed (:issue:`3499`)
+
 - ical
 
   - Enabled this format for Python 3 too.
diff --git a/docs/releases/index.rst b/docs/releases/index.rst
index fb9313d..8595f79 100644
--- a/docs/releases/index.rst
+++ b/docs/releases/index.rst
@@ -8,6 +8,7 @@ The following are release notes for Translate Toolkit:
 .. toctree::
    :maxdepth: 1
 
+   2.0.0 <2.0.0>
    2.0.0rc3 <2.0.0rc3>
    2.0.0rc2 <2.0.0rc2>
    2.0.0rc1 <2.0.0rc1>
diff --git a/tests/cli/data/test_po2txt/one.po b/tests/cli/data/test_po2txt/one.po
new file mode 100644
index 0000000..1aad549
--- /dev/null
+++ b/tests/cli/data/test_po2txt/one.po
@@ -0,0 +1,13 @@
+msgctxt "first"
+msgid "One"
+msgstr "Een"
+
+msgctxt "second"
+msgid "One"
+msgstr "Won"
+
+msgid "Two two"
+msgstr "Twee twee"
+
+msgid "Three three"
+msgstr ""
diff --git a/tests/cli/data/test_po2txt/out.txt b/tests/cli/data/test_po2txt/out.txt
new file mode 100644
index 0000000..2fe6125
--- /dev/null
+++ b/tests/cli/data/test_po2txt/out.txt
@@ -0,0 +1,7 @@
+Een
+
+Won
+
+Twee twee
+
+Three three
\ No newline at end of file
diff --git a/tests/cli/data/test_po2txt_threshold/one.po b/tests/cli/data/test_po2txt_threshold/one.po
new file mode 100644
index 0000000..1aad549
--- /dev/null
+++ b/tests/cli/data/test_po2txt_threshold/one.po
@@ -0,0 +1,13 @@
+msgctxt "first"
+msgid "One"
+msgstr "Een"
+
+msgctxt "second"
+msgid "One"
+msgstr "Won"
+
+msgid "Two two"
+msgstr "Twee twee"
+
+msgid "Three three"
+msgstr ""
diff --git a/tests/cli/data/test_po2txt_threshold/out.txt b/tests/cli/data/test_po2txt_threshold/out.txt
new file mode 100644
index 0000000..e69de29
diff --git a/tests/cli/data/test_pofilter_manpage/stdout.txt b/tests/cli/data/test_pofilter_manpage/stdout.txt
index 0938732..bf0a509 100644
--- a/tests/cli/data/test_pofilter_manpage/stdout.txt
+++ b/tests/cli/data/test_pofilter_manpage/stdout.txt
@@ -1,5 +1,5 @@
 .\" Autogenerated manpage
-.TH pofilter 1 "Translate Toolkit 2.0.0rc3" "" "Translate Toolkit 2.0.0rc3"
+.TH pofilter 1 "Translate Toolkit 2.0.0" "" "Translate Toolkit 2.0.0"
 .SH NAME
 pofilter \- Perform quality checks on Gettext PO, XLIFF and TMX localization files.
 .SH SYNOPSIS
diff --git a/tests/cli/test_pocount_nonexistant.sh b/tests/cli/test_po2txt.sh
similarity index 64%
copy from tests/cli/test_pocount_nonexistant.sh
copy to tests/cli/test_po2txt.sh
index b2e5b45..8f319e8 100755
--- a/tests/cli/test_pocount_nonexistant.sh
+++ b/tests/cli/test_po2txt.sh
@@ -2,5 +2,5 @@
 
 source $(dirname $0)/test.inc.sh
 
-pocount missing.po
+po2txt --progress=none $one $out
 check_results
diff --git a/tests/cli/test_po2txt_threshold.sh b/tests/cli/test_po2txt_threshold.sh
new file mode 100755
index 0000000..b48c99d
--- /dev/null
+++ b/tests/cli/test_po2txt_threshold.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source $(dirname $0)/test.inc.sh
+
+# We expect no output as translations are not complete
+po2txt --progress=none --threshold=100 $one $out
+check_results
diff --git a/translate/__version__.py b/translate/__version__.py
index a4107e6..b1c3557 100644
--- a/translate/__version__.py
+++ b/translate/__version__.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright 2008-2009 Zuza Software Foundation
+# Copyright 2008-2017 Zuza Software Foundation
 #
 # This file is part of the Translate Toolkit.
 #
@@ -19,14 +19,14 @@
 
 """This file contains the version of the Translate Toolkit."""
 
-build = 20010
+build = 20011
 """The build number is used by external users of the Translate Toolkit to
 trigger refreshes.  Thus increase the build number whenever changes are made to
 code touching stats or quality checks.  An increased build number will force a
 toolkit user, like Pootle, to regenerate it's stored stats and check
 results."""
 
-sver = "2.0.0rc3"
+sver = "2.0.0"
 """Human readable version number. Used for version number display."""
 
 ver = (2, 0, 0)
diff --git a/translate/convert/convert.py b/translate/convert/convert.py
index f1f6c02..dee38f9 100644
--- a/translate/convert/convert.py
+++ b/translate/convert/convert.py
@@ -481,13 +481,16 @@ def should_output_store(store, threshold):
 
     from translate.storage import statsdb
 
-    units = filter(lambda unit: unit.istranslatable(), store.units)
-    translated = filter(lambda unit: unit.istranslated(), units)
-    wordcounts = dict(map(lambda unit: (unit, statsdb.wordsinunit(unit)), units))
-    sourcewords = lambda elementlist: sum(map(lambda unit: wordcounts[unit][0], elementlist))
-    tranlated_count = sourcewords(translated)
+    units = list(filter(lambda unit: unit.istranslatable(), store.units))
+    translated = list(filter(lambda unit: unit.istranslated(), units))
+    wordcounts = dict(map(lambda unit: (unit.getid(), statsdb.wordsinunit(unit)), units))
+
+    def sourcewords(elementlist):
+        return sum(map(lambda unit: wordcounts[unit.getid()][0], elementlist))
+
+    translated_count = sourcewords(translated)
     total_count = sourcewords(units)
-    percent = tranlated_count * 100 / total_count
+    percent = translated_count * 100 / total_count
 
     return percent >= threshold
 
diff --git a/translate/storage/mozilla_lang.py b/translate/storage/mozilla_lang.py
index de87084..04e6cf9 100644
--- a/translate/storage/mozilla_lang.py
+++ b/translate/storage/mozilla_lang.py
@@ -56,7 +56,8 @@ class LangUnit(base.TranslationUnit):
         if self.source == self.target:
             target = self.target + " {ok}"
         if (self.rawtarget is not None
-            and self.target == strip_ok(self.rawtarget)):
+            and self.target == strip_ok(self.rawtarget)
+            and len(self.target) != len(strip_ok(self.rawtarget))):
             target = self.rawtarget
         if self.getnotes():
             notes = (self.eol).join(
@@ -107,7 +108,11 @@ class LangStore(txt.TxtFile):
                 self.is_active = True
                 continue
 
-            if line.startswith("## ") and not line.startswith('## TAG'):
+            header_meta_data = (
+                line.startswith("## ")
+                and not line.startswith('## TAG')
+                and not line.startswith('## MAX_LENGTH'))
+            if header_meta_data:
                 self._headers.append(line)
                 continue
 
@@ -130,9 +135,10 @@ class LangStore(txt.TxtFile):
             is_comment = (
                 line.startswith('#')
                 and (not line.startswith("##")
-                     or line.startswith('## TAG')))
+                     or line.startswith('## TAG')
+                     or line.startswith('## MAX_LENGTH')))
             if is_comment:
-                # Read comments, *including* meta tags (i.e. '## TAG')
+                # Read comments, *including* meta tags (e.g. '## TAG')
                 comment += line[1:].strip() + "\n"
 
             if line.startswith(';'):
diff --git a/translate/storage/test_mozilla_lang.py b/translate/storage/test_mozilla_lang.py
index 1b3c98a..97a80cb 100644
--- a/translate/storage/test_mozilla_lang.py
+++ b/translate/storage/test_mozilla_lang.py
@@ -64,6 +64,31 @@ class TestMozLangUnit(test_base.TestTranslationUnit):
             "# TAG: goodbye"
             in unit.getnotes(origin="developer").split("\n"))
 
+    def test_copy_target(self):
+        """Validate that self.rawtarget does not break a valid translation.
+
+        self.rawtarget is used to preserve strange format anomalies related to
+        {ok}.  But when units got translated it sometimes caused issues, in
+        that the unit was correctly translated but when serialised it used
+        self.rawtarget and thus output an untranslated unit.  This checks that
+        translation actually results in rawformat being ignored.
+        """
+        unit = self.UnitClass("Device")
+        unit.target == ""
+        unit.rawtarget = "Device"
+        assert not unit.istranslated()
+        assert str(unit) == ";Device\nDevice"
+
+        other = self.UnitClass("Device")
+        other.target = "Device"
+        assert other.istranslated()
+        assert str(other) == ";Device\nDevice {ok}"
+
+        unit.target = other.target
+        assert unit.istranslated()
+        assert unit.target == "Device"
+        assert str(unit) == ";Device\nDevice {ok}"
+
 
 class TestMozLangFile(test_base.TestTranslationStore):
     StoreClass = mozilla_lang.LangStore
@@ -260,3 +285,17 @@ class TestMozLangFile(test_base.TestTranslationStore):
         assert (
             "# TAG: another_important_tag"
             in store.units[0].getnotes(origin="developer").split("\n"))
+
+    def test_maxlength(self):
+        """Ensure we can handle MAX_LENGTH meta data"""
+        lang = ("## MAX_LENGTH: 80\n"
+                "# Comment\n"
+                ";Source\n"
+                "Target\n"
+                "\n\n")
+        store = self.StoreClass.parsestring(lang)
+        assert not store.getlangheaders()
+        assert bytes(store).decode('utf-8') == lang
+        assert (
+            "# MAX_LENGTH: 80"
+            in store.units[0].getnotes(origin="developer").split("\n"))
-----------------------------------------------------------------------


hooks/post-receive
-- 
translate-toolkit



More information about the Debian-l10n-commits mailing list