From 846fc19d719182700656039f91f09e212cabd9ec Mon Sep 17 00:00:00 2001 From: Nick Timkovich Date: Thu, 10 Aug 2017 15:07:52 -0500 Subject: [PATCH] Fix pofile for pseudo translations The pofile name in the pseudo translation logic appears to expect the babel.messages object, not the string holding the location of the pofile. Trimmed a string that gettext reacts poorly with when creating pseudo- translations. Change-Id: I811711412d85a989826a946d1d57ed39790e34ed Closes-Bug: 1710003 --- horizon/templates/horizon/common/_data_table_pagination.html | 2 +- openstack_dashboard/management/commands/update_catalog.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/horizon/templates/horizon/common/_data_table_pagination.html b/horizon/templates/horizon/common/_data_table_pagination.html index 468a0af9d4..4c0547adff 100644 --- a/horizon/templates/horizon/common/_data_table_pagination.html +++ b/horizon/templates/horizon/common/_data_table_pagination.html @@ -1,7 +1,7 @@ {% load i18n %} - {% blocktrans count counter=rows|length %} + {% blocktrans count counter=rows|length trimmed %} Displaying {{ counter }} item{% plural %} Displaying {{ counter }} items{% endblocktrans %} {% if table.has_prev_data or table.has_more_data %} diff --git a/openstack_dashboard/management/commands/update_catalog.py b/openstack_dashboard/management/commands/update_catalog.py index b534029d21..07360da61a 100644 --- a/openstack_dashboard/management/commands/update_catalog.py +++ b/openstack_dashboard/management/commands/update_catalog.py @@ -19,6 +19,7 @@ import os from subprocess import call import babel.messages.catalog as catalog +import babel.messages.pofile as babel_pofile from django.conf import settings from django.core.management.base import BaseCommand from django.utils import translation @@ -102,7 +103,7 @@ class Command(BaseCommand): # Pseudo translation logic with open(potfile, 'r') as f: - pot_cat = pofile.read_po(f, ignore_obsolete=True) + pot_cat = babel_pofile.read_po(f, ignore_obsolete=True) new_cat = catalog.Catalog(locale=locale, last_translator="pseudo.py", @@ -119,4 +120,4 @@ class Command(BaseCommand): new_cat[msg.id] = msg with open(pofile, 'w') as f: - pofile.write_po(f, new_cat, ignore_obsolete=True) + babel_pofile.write_po(f, new_cat, ignore_obsolete=True)