Different use of args in ungettext_lazy causes error on syncing with translation infra

Bug #1630507 reported by Ian Y. Choi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Unassigned

Bug Description

In http://git.openstack.org/cgit/openstack/horizon/tree/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py#n214 ,

If we look at strings for singular and plural on ungettext_lazy(),
singular string uses only "%(avail)i" arg,
and plural string uses both "%(req)i" and "%(avail)i" args.

In Zanata (translation platform), currently, po files on some languages are saved if the languages are set to just use singular form.

#: openstack_dashboard/dashboards/project/instances/workflows/create_instance.py:214
#, python-format
msgid ""
"The requested instance cannot be launched as you only have %(avail)i of your "
"quota available. "
msgid_plural ""
"The requested %(req)i instances cannot be launched as you only have "
"%(avail)i of your quota available."
msgstr[0] ""
"The requested instance cannot be launched as you only have %(avail)i of your "
"quota available. "

This generates an error when msgfmt command is executed:

$ msgfmt --check-format -o /dev/null django.po
django.po:10766: a format specification for argument 'req' doesn't exist in 'msgstr[0]'
msgfmt: found 1 fatal error

Because of this occurrence, there have been job failures for Korean and Indonesian language
to import translated strings to Horizon git repository.

The current solution would be to add "%(req)i" argument on the singular string.

Reference
[1] http://lists.openstack.org/pipermail/openstack-dev/2016-September/103941.html
[2] http://lists.openstack.org/pipermail/openstack-i18n/2016-October/002476.html

Ian Y. Choi (ianychoi)
description: updated
tags: added: in-stable-newton newton-backport-potential
Revision history for this message
Ian Y. Choi (ianychoi) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/386954

Changed in horizon:
assignee: nobody → Ian Y. Choi (ianychoi)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/386955

tags: removed: in-stable-newton
Changed in horizon:
milestone: none → ocata-2
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (stable/newton)

Change abandoned by Rob Cresswell (<email address hidden>) on branch: stable/newton
Review: https://review.openstack.org/386955
Reason: Due to 2 months without update

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Rob Cresswell (<email address hidden>) on branch: master
Review: https://review.openstack.org/386954
Reason: >2 months without update

Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :

Removing assignee due to inactivity.

Changed in horizon:
assignee: Ian Y. Choi (ianychoi) → nobody
milestone: ocata-2 → next
status: In Progress → Confirmed
Changed in horizon:
assignee: nobody → Ian Y. Choi (ianychoi)
status: Confirmed → In Progress
Changed in horizon:
assignee: Ian Y. Choi (ianychoi) → Rob Cresswell (robcresswell)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/386954
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=0409080e7b93a91323bbb69e1811ef79b17c4e6d
Submitter: Jenkins
Branch: master

commit 0409080e7b93a91323bbb69e1811ef79b17c4e6d
Author: Ian Y. Choi <email address hidden>
Date: Sat Oct 15 23:14:52 2016 +0900

    i18n: The same use of args with ugettext_lazy

    Different use of args in ungettext_lazy causes
    error on import job from translation infrastructure
    to horizon repository.

    The use of variables in singular and plural strings
    needs to be same. This commit also adjusts the string
    with ugettext_lazy() as other strings are dealt with.

    Change-Id: I9a836178b2d615504950545654242c0a4c196723
    Closes-Bug: #1630507

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 11.0.0.0rc1

This issue was fixed in the openstack/horizon 11.0.0.0rc1 release candidate.

Changed in horizon:
milestone: next → ocata-rc1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.