Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing problems raised in sphinx_issues #10104 #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sphinx_intl/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def load_po(filename):
return pofile.read_po(f, charset=charset)


def dump_po(filename, catalog, line_width=76):
def dump_po(filename, catalog, line_width=76, sort_output=False, sort_by_message_location=False):
Copy link
Member

@shimizukawa shimizukawa Apr 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add param lines on docstring for new 2 parameters.

These two arguments are not set to True within this tool and may be removed as unnecessary arguments. As a remedy, please describe the purpose for which they are arguments in the docstring or code comment.

UPDATED: please fix linter error.

"""write po/pot file from catalog object

:param unicode filename: path to po file
Expand All @@ -37,7 +37,7 @@ def dump_po(filename, catalog, line_width=76):

# Because babel automatically encode strings, file should be open as binary mode.
with io.open(filename, 'wb') as f:
pofile.write_po(f, catalog, line_width)
pofile.write_po(f, catalog, line_width, sort_output=sort_output, sort_by_file=sort_by_message_location)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memo

https://babel.pocoo.org/en/latest/api/messages/pofile.html#babel.messages.pofile.write_po

  • sort_output – whether to sort the messages in the output by msgid
  • sort_by_file – whether to sort the messages in the output by their locations

defaults are False: sort_output=False, sort_by_file=False



def write_mo(filename, catalog):
Expand Down