Errors from po reader are not shown anywhere

Created on 26 August 2012, almost 13 years ago
Updated 18 July 2023, almost 2 years ago

After importing translations from po file errors/warnings from po reader are not shown anywhere
I've implemented possible solution and created a patch:
after all lines are read in Gettext::fileToDatabase
Errors from reader are appended to $report array
and then they are printed to watchdog with other messages in locale_translate_batch_finished

I still need to check if line numbers are correct. I think it was something wrong there. But first would be good to get some feedback if it is needed and if it is right solution.

✨ Feature request
Status

Postponed: needs info

Version

9.5

Component
LocaleΒ  β†’

Last updated 4 days ago

Created by

πŸ‡±πŸ‡ΉLithuania MantasK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Have not seen any errors during import of translations? Wonder if this is still an issue in D10?

  • πŸ‡ΊπŸ‡ΈUnited States calebtr

    I ran into this on a Drupal 10.3 site. From what I see in the 11.x code, it is still an issue.

    For me, the specific issue is that in locale.bulk.inc, exceptions caught in locale_translate_batch_import() log only generic messages.

    To replicate:

    1. Create a .po file with an error it. I have attached an example.

    2. Create a site with the language for the .po file enabled.

    3. Attempt to import the .po file at /admin/config/regional/translate/import.

    4. See the error, "One translation file could not be imported. See the log for details."

    5. See log, no details are included.

    What I expect to happen:

    Specific error messages are logged. In this case, "The plural formula could not be parsed."

    Next steps

    The patch in this issue wouldn't apply; it calls watchdog() instead of \Drupal::logger().

    I don't see any other places in locale.bulk.inc where a specific error message isn't logged, but I may have missed something and there may be other places in the module.

    A simple way to address this is to assign the Exception to a variable and include $e->getMessage() in the log.

  • πŸ‡ΊπŸ‡ΈUnited States calebtr
  • πŸ‡ΊπŸ‡ΈUnited States calebtr

    I'm happy to do more work on this at the maintainers' direction.

  • Pipeline finished with Failed
    8 months ago
    Total: 579s
    #327308
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Have not reviewed yet but issue summary appears to be incomplete, recommend using standard template for that. May need test coverage as well.

  • πŸ‡ΊπŸ‡ΈUnited States calebtr

    I erred on the side of contributing to an existing issue. Would you rather I open a new one?

Production build 0.71.5 2024