Skip to content

Feature request: check po syntax before update #119

Open
@yguel

Description

@yguel

Steps to reproduce the problem

In a po file when for a specific entry:

#: ../../source/c01_robot_modeling/c01s04_urdf_practical.rst:3
msgid "URDF par la pratique: le scanbot"
msgstr "URDF in Practice: The Scanbot"

Create a syntax error in the file, for instance:

#: ../../source/c01_robot_modeling/c01s04_urdf_practical.rst:3
msgid "URDF par la pratique: le scanbot"
msgstr "URDF in Practice: The Scanbot"
msgstr "THERE SHOULD NOT BE THE KEYWORD msgstr IN THE BEGINING OF THIS LINE"

Then run sphinx-intl update:

sphinx-intl update -p build/gettext -d source/locales

sphinx-intl considered that nothing has changed.
However if msgmerge is used, a syntax error is correctly raised for the beginning of the line 4th line.

Proposed feature to solve the problem

Add a syntax check on the file before attempting the merge and report the errors such that they are displayed in the console if the command was used from the command line.

Attempt for a roadmap for implementation

With a bit of guidance, I am willing to implement the feature if it is seemed the reasonable way to solve the problem by the maintainer team.

Steps I imagine implementing:

  1. Before each call to basic.update
  2. In function update before line 315 of sphinx_intl/commands.py
    I would call for each file: msgfmt --check path_to/the_po_file.po
  3. look for errors and report them
  4. if there are any fatal errors I will mark the update as having failed

For that approach to be feasible, I would need to call msgfmt. I am not sure I understand correctly, but it seems to me that, for the moment, the project has no dependency on gettext the package that provides msgfmt.
Am I correct ? Is it possible/acceptable to add a dependency on gettext ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions