Fixed Localization in the Admin UI Settings forms

Review Request #8639 — Created Jan. 20, 2017 and submitted

Information

Review Board
master
60573e8...

Reviewers

The forms in reviewboard.admin.forms use ugettext (as _(...)) for the form fields, which means they're not localized at page render time. To fix this, I updated the _ alias to be for ugettext_lazy instead of ugettext and imported ugettext.

I compared translations in the webpage with django's translation log (reviewboard/locale/it_IT/LC_MESSAGES/django.po:msgstr), and ensured translations from the log are also visible in the webpage.

Description From Last Updated

Make sure the description and testing text wraps to ideally <= 70 characters (a standard line length for Git commits), …

chipx86chipx86

This is happening within a method (not the top-level class), so we should make it use the regular ugettext().

daviddavid

Should use ugettext().

daviddavid

Should use ugettext().

daviddavid

Should use ugettext().

daviddavid

Should use ugettext().

daviddavid

Should use ugettext().

daviddavid

Should use ugettext().

daviddavid

Should use ugettext().

daviddavid

Should use ugettext().

daviddavid

Col: 44 W292 no newline at end of file

reviewbotreviewbot

Col: 55 W292 no newline at end of file

reviewbotreviewbot

Can you remove this blank line? (so the function definition is adjacent to the property set)

daviddavid

There's no ugettext import. The code as up for review cannot work. Make sure you test every code path!

chipx86chipx86

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

Make sure text is aligned properly.

chipx86chipx86

Col: 80 E501 line too long (86 > 79 characters)

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

undefined name 'ugettext'

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Make sure text is aligned properly.

chipx86chipx86

Col: 44 W292 no newline at end of file

reviewbotreviewbot

django is a third-party module, so it should be in its own import group, above reviewboard, separated by a blank …

chipx86chipx86

Strings should ideally be single quotes. Can you fix up the old one as well?

chipx86chipx86

Col: 55 W292 no newline at end of file

reviewbotreviewbot

Strings should ideally be single quotes.

chipx86chipx86

Strings should ideally be single quotes.

chipx86chipx86

Col: 25 E128 continuation line under-indented for visual indent

reviewbotreviewbot

Col: 19 E128 continuation line under-indented for visual indent

reviewbotreviewbot

Col: 19 E128 continuation line under-indented for visual indent

reviewbotreviewbot

There shouldn't be a blank line here (both "django" and "djblets" are "3rd party libraries" from the perspective of the …

daviddavid

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

It was already like this, but can you fix this string to only end in a single period?

daviddavid

Please undo this line addition.

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
  2. Show all issues
    Col: 44
     W292 no newline at end of file
    
  3. Show all issues
    Col: 55
     W292 no newline at end of file
    
  4. 
      
david
  1. There's a number of comments here, but it's really all just the same issue: any call to _() within a method should use ugettext().

  2. reviewboard/admin/forms.py (Diff revision 1)
     
     
    Show all issues

    This is happening within a method (not the top-level class), so we should make it use the regular ugettext().

  3. reviewboard/admin/forms.py (Diff revision 1)
     
     
    Show all issues

    Should use ugettext().

  4. reviewboard/admin/forms.py (Diff revision 1)
     
     
    Show all issues

    Should use ugettext().

  5. reviewboard/admin/forms.py (Diff revision 1)
     
     
    Show all issues

    Should use ugettext().

  6. reviewboard/admin/forms.py (Diff revision 1)
     
     
     
     
    Show all issues

    Should use ugettext().

  7. reviewboard/admin/forms.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
    Show all issues

    Should use ugettext().

  8. reviewboard/admin/forms.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Should use ugettext().

  9. reviewboard/admin/forms.py (Diff revision 1)
     
     
    Show all issues

    Should use ugettext().

  10. reviewboard/admin/forms.py (Diff revision 1)
     
     
    Show all issues

    Should use ugettext().

  11. reviewboard/scmtools/admin.py (Diff revision 1)
     
     
    Show all issues

    Can you remove this blank line? (so the function definition is adjacent to the property set)

  12. 
      
RK
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
  2. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  3. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  4. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  5. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  6. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  7. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
    Col: 80
     E501 line too long (86 > 79 characters)
    
  8. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  9. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  10. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  11. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  12. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  13. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  14. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  15. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  16. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  17. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'ugettext'
    
  18. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  19. Show all issues
    Col: 44
     W292 no newline at end of file
    
  20. Show all issues
    Col: 55
     W292 no newline at end of file
    
  21. 
      
RK
chipx86
  1. 
      
  2. Show all issues

    Make sure the description and testing text wraps to ideally <= 70 characters (a standard line length for Git commits), as this will be used for the Git commit.

    The description should also tell a story about your change, rather than being effectively a bullet point list of the changes made. See https://www.notion.so/reviewboard/Writing-Good-Change-Descriptions-10529e7c207743fa8ca90153d4b21fea for information on requirements and examples.

    1. Hi Christian,

      I thought that the description and testing text can be a little longer depending on the complexity of the bug. I tried to make it shorter, let me know if I still need to make it shorter. Thanks!

    2. Any length is fine, we just want to wrap it.

    3. They should definitely be as detailed as needed to properly convey what the change is about (imagine you're writing this for a friend who doesn't know what you're working on, and you're telling them about it). You just want to make sure the lines wrap.

      Best tip is to write this when doing the commit, making sure it's wrapping at the right place, and then use that for the review request. This will automatically be pulled in from the commit message, and you can always update from the review request with:

      rbt post -g yes <other arguments you pass>
      
  3. reviewboard/admin/forms.py (Diff revision 2)
     
     
    Show all issues

    There's no ugettext import. The code as up for review cannot work. Make sure you test every code path!

  4. reviewboard/admin/forms.py (Diff revision 2)
     
     
     
    Show all issues

    Make sure text is aligned properly.

  5. reviewboard/admin/forms.py (Diff revision 2)
     
     
     
     
    Show all issues

    Make sure text is aligned properly.

  6. Show all issues

    django is a third-party module, so it should be in its own import group, above reviewboard, separated by a blank line.

  7. reviewboard/reviews/models/group.py (Diff revision 2)
     
     
    Show all issues

    Strings should ideally be single quotes.

    Can you fix up the old one as well?

  8. reviewboard/scmtools/admin.py (Diff revision 2)
     
     
    Show all issues

    Strings should ideally be single quotes.

  9. reviewboard/scmtools/models.py (Diff revision 2)
     
     
     
    Show all issues

    Strings should ideally be single quotes.

  10. 
      
RK
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
  2. reviewboard/admin/forms.py (Diff revision 3)
     
     
    Show all issues
    Col: 25
     E128 continuation line under-indented for visual indent
    
  3. reviewboard/admin/forms.py (Diff revision 3)
     
     
    Show all issues
    Col: 19
     E128 continuation line under-indented for visual indent
    
  4. reviewboard/admin/forms.py (Diff revision 3)
     
     
    Show all issues
    Col: 19
     E128 continuation line under-indented for visual indent
    
  5. 
      
RK
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
  2. reviewboard/admin/forms.py (Diff revision 4)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  3. 
      
RK
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
  2. 
      
david
  1. Just a few trivial comments:

  2. reviewboard/admin/forms.py (Diff revision 4)
     
     
    Show all issues

    There shouldn't be a blank line here (both "django" and "djblets" are "3rd party libraries" from the perspective of the reviewboard module).

  3. reviewboard/admin/forms.py (Diff revision 4)
     
     
    Show all issues

    It was already like this, but can you fix this string to only end in a single period?

  4. Show all issues

    Please undo this line addition.

  5. 
      
RK
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/admin/forms.py
        reviewboard/reviews/models/screenshot.py
        reviewboard/reviews/models/review_request_draft.py
        reviewboard/scmtools/models.py
        reviewboard/scmtools/admin.py
        reviewboard/reviews/models/file_attachment_comment.py
        reviewboard/reviews/models/group.py
        reviewboard/reviews/models/diff_comment.py
        reviewboard/reviews/models/review_request.py
        reviewboard/reviews/models/status_update.py
        reviewboard/reviews/models/default_reviewer.py
        reviewboard/reviews/models/general_comment.py
        reviewboard/reviews/models/screenshot_comment.py
        reviewboard/reviews/models/review.py
    
    
  2. 
      
brennie
  1. Ship It!
  2. 
      
RK
  1. Ship It!
  2. 
      
RK
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (72483db)