← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2037278] Re: Cannot translate messages in network_qos edit-rule form

 

Reviewed:  https://review.opendev.org/c/openstack/horizon/+/896978
Committed: https://opendev.org/openstack/horizon/commit/783b2039f043d37156eb0c8a9697930e63aee2da
Submitter: "Zuul (22348)"
Branch:    master

commit 783b2039f043d37156eb0c8a9697930e63aee2da
Author: Akihiro Motoki <amotoki@xxxxxxxxx>
Date:   Sun Oct 1 17:55:40 2023 +0900

    i18n: Avoid using variables in gettext() in network QoS edit rule
    
    If an argument to gettext() contains variables, strings extracted
    and strings used when rendered will be different (as variables are
    evaluated as empty during string extraction to POT).
    As a result, translations for these strings aree never used.
    
    This commit fixes the issue by defining strings with variable
    substitions (like%(id)s) in gettext() combined with interpolate().
    
    Labels of "Rule to edit" pulldown menu in "Edit Rule" form are
    updated to match the format used in "Delete Rule" form.
    
    Closes-Bug: #2037278
    Change-Id: I06cb56ada2c842e5a445026b4649260bf9893841


** Changed in: horizon
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/2037278

Title:
  Cannot translate messages in network_qos edit-rule form

Status in OpenStack Dashboard (Horizon):
  Fix Released

Bug description:
  There are strings which cannot be translated in network_qos edit-rule
  form.

  It is because strings passed to gettext() contains variables. Such
  variables are evaluated as empty when generating the POT file. For
  example, a string in [1] will be "Bandwidth Limit - , , , " in the
  djangojs POT file.

  On the other hand, when displaying the form these variables are
  evaluated and the corresponding string in PO file cannot be found.

  edit-rule.controller.js contains the similar strings as [1].

  When we need to pass variables to a translatable string, we should use
  interpolate() as we do in many files.

  [1]
  https://opendev.org/openstack/horizon/src/branch/master/openstack_dashboard/static/app/core/network_qos/actions/edit-
  rule.controller.js#L42-L43

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/2037278/+subscriptions



References