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

TypeError: "not all arguments converted during string formatting" in on_export_download_dialog_done #7599

Closed
kozlovsky opened this issue Sep 18, 2023 · 2 comments
Assignees
Milestone

Comments

@kozlovsky
Copy link
Contributor

Here:

    def on_export_download_request_done(self, filename, data):
        ...
        try:
            ...
        except OSError as exc:
            ...
            tr("An error occurred when exporting the torrent file: %s") % str(exc),
            ...

The reason for the error is an incorrect translation in ru_RU.ts:

    <message>
        <location filename="../widgets/downloadspage.py" line="463"/>
        <source>An error occurred when exporting the torrent file: %s</source>
        <translation>Ошибка при экспорте торрент-файла:</translation>
    </message>

We already have a TranslatedString class that catches KeyError exception, it should catch TypeError exceptions as well to prevent the application crash in case of such an error.

Also, it may be a good idea to add a tool that analyzes translation files and checks that the number of %s placeholders in each translated string is the same as in the corresponding original string.

@kozlovsky kozlovsky added this to the 7.14.0 milestone Sep 18, 2023
@sentry-for-tribler
Copy link

Sentry issue: TRIBLER-1C0

@kozlovsky kozlovsky self-assigned this Oct 2, 2023
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Oct 2, 2023
…e the correct number of positional parameters
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Oct 2, 2023
…e the correct number of positional parameters
kozlovsky added a commit that referenced this issue Oct 2, 2023
Fixes #7599: TypeError when the translated string does not have the correct number of positional parameters
@kozlovsky
Copy link
Contributor Author

Fixed in #7615

@drew2a drew2a modified the milestones: 7.14.0, 7.13.1 Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants