importing po files

  • Unknown's avatar

    Ok it’s been a while and I’m working on bringing our translation up to date but I can’t figure out how to get the uploader to accept a po file. I go to upload, select the file and hit upload but then all I get is “Couldn’t load translations from file!” I checked the po, the translations are there and I can’t see anything in the format that looks like the file got corrupted or anything. I have the right permissions as far as I know – and I’m sure I’ve uploaded in the past.

    What am I missing?

    The blog I need help with is: (visible only to logged in users)

  • Hi there!

    Can you please let me know the address of the site you’re working on?

    Please note that these forums are for WordPress.com hosted sites only. If your site is using the open-source WordPress.org software you need to seek help at these forums:

    https://wordpress.org/support/forums/

  • Unknown's avatar
  • Hi there,

    From where did you get the file that you’re trying to import? Did you export it from the translation project on WordPress.org, or was it compiled manually? And if exported, did you make any modifications to the file directly after exporting it?

  • Unknown's avatar

    I exported the file from https://translate.wordpress.com/projects/wpcom/gd/default as a po. I translated a few strings in Trados Studio, saved as a po file and the tried to re-import it. I did not compile anything manually.

  • What specific string or phrase is causing the problem?

  • Unknown's avatar

    I only did the first few to double check import was working correctly. This is the start of the po:

    # Translation of WordPress.com in Scottish Gaelic
    # This file is distributed under the same license as the WordPress.com package.
    msgid ""
    msgstr ""
    "PO-Revision-Date: 2019-10-27 16:54:02+0000n"
    "MIME-Version: 1.0n"
    "Content-Type: text/plain; charset=UTF-8n"
    "Content-Transfer-Encoding: 8bitn"
    "Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;n"
    "X-Generator: GlotPress/2.4.0-alphan"
    "Language: gd_GBn"
    "Project-Id-Version: WordPress.comn"
    
    #: client/my-sites/checklist/wpcom-checklist/component.jsx:596
    msgid "You skipped launching your site"
    msgstr "Leum thu thairis air cur air bhog na làraich agad"
    
    #: client/my-sites/customer-home/main.jsx:176
    msgid "Only you and those you invite can view your site. Launch your site to make it visible to the public."
    msgstr "Chan fhaic ach thu fhèin agus an fheadhainn a bheir thu cuireadh dhaibh an làrach agad. Cuir air bhog an làrach agad ach am bi e poblach."
    
    #: client/my-sites/customer-home/main.jsx:175
    msgid "Your site is private"
    msgstr "Tha an làrach agad prìobhaideach"
    
    #: wp-includes/post.php:2755
    msgctxt "file type group"
    msgid "Archives"
    msgstr "Tasg-lannan"
    
    #. translators: %s: The current WordPress version number.
    #: wp-admin/privacy.php:43
    msgid "Introducing our most refined user experience with the improved block editor in WordPress %s!"
    msgstr ""
    
    #: wp-includes/user.php:230
    msgid "Unknown email address. Check again or try your username."
    msgstr ""
  • Could you confirm what you’re importing into right now?

  • Unknown's avatar

    I’ve explained that before. Go to https://translate.wordpress.com/projects/wpcom/gd/default and scroll to the bottom of the translations, there’s an Import link to the left of Translations and Export. The link takes you to this page https://translate.wordpress.com/projects/wpcom/gd/default/import-translations/

    Where else would I import to? 😕

  • Also, to confirm, on the one where you have just a few strings, did that one import correctly?

    And, if you import the file you download from us without making any changes in Trados Studio, does that work?

  • Unknown's avatar

    NOTHING imports.

    As for uploading an unchanged file, no idea, never tried.

  • Thanks, and to clarify:

    1) What are you importing into?

    2) Can you try importing without making any changes?

  • Unknown's avatar

    1) What are you importing into?

    Not sure what you mean with that question. I’ve tried the default settings (AutoDetect and Current) and I’ve tried setting it to po and Current and/or Waiting. None of these permutations result in anything but the error.

    2) Can you try importing without making any changes?
    So I filtered by “Untranslated” and exported “only matching filter”. I downloaded the file, made no changes, and uploaded it. This time, it did upload but bizarrely, it added 12 strings as fuzzy (https://translate.wordpress.com/projects/wpcom/gd/default/?filters%5Btranslated%5D=yes&filters%5Bstatus%5D=waiting) with empty targets. There’s something broken about the export and import if you ask me…

  • Not sure what you mean with that question.

    Can you send a link to the page where you are starting the import?

  • Unknown's avatar

    I pasted the link where I upload several times already, here it is again:
    https://translate.wordpress.com/projects/wpcom/gd/default/import-translations/

  • Ok, would you be able to provide the po file via another means, like Dropbox, iCloud Drive, Google Drive, etc?

    That way, we can test the file itself.

    Thanks!

  • Unknown's avatar
  • Hi akerbeltzalba,

    thank you for providing the file! I took a look at the file and unfortunately it is not a valid PO file (see below), this is likely why the import fails.

    Also, it’s a big 4MB file with only 4 translated items, and lots of empty translations. It would be easier to handle if it just included the translated strings, is there an option in Trados to export only the translated items?

    For you to try, I have created such a smaller file here by removing all of the empty translations: https://gist.github.com/akirk/023ade4492088e48f174b5be2ed44c28

    I didn’t import it to translate.wordpress.com because you should do this to get the credit :-) The URL you mentioned for this is correct (but it only works because you are a validator).

    Hope this helps, thanks for helping translating! btw, we’ll be able to help you quicker with these kind of problems in the WordPress.com translation community: https://wpcomtranslation.wordpress.com

    PS: This is the msgcat output explaining the errors (all in untranslated items):

    $ msgcat wpcom-gd.po 
    wpcom-gd.po:32498: end-of-line within string
    wpcom-gd.po:32499: end-of-line within string
    wpcom-gd.po:32500: end-of-line within string
    wpcom-gd.po:32501: end-of-line within string
    wpcom-gd.po:32502: end-of-line within string
    wpcom-gd.po:32503: end-of-line within string
    wpcom-gd.po:32504: end-of-line within string
    wpcom-gd.po:32505: end-of-line within string
    msgcat: found 8 fatal errors
    
  • Unknown's avatar

    Also, it’s a big 4MB file with only 4 translated items, and lots of empty translations. It would be easier to handle if it just included the translated strings, is there an option in Trados to export only the translated items?

    It only had four translations in it because I wanted to make sure importing it would work, there’s nothing worse than translating 4k words to discover devs have turned off the import feature (has happened to me before).

    Thanks for posting the offending lines – so it seems that Trados turned

    #: async-jobs/includes/github-pr-report-bot.php:103
    msgid "There is %d PR:n"
    msgid_plural "There are %d PRs:n"
    msgstr[0] "n"
    msgstr[1] "n"
    msgstr[2] "n"
    msgstr[3] "n"

    into

    #: async-jobs/includes/github-pr-report-bot.php:103
    msgid "There is %d PR:n"
    msgid_plural "There are %d PRs:n"
    msgstr[0] "
    "
    msgstr[1] "
    "
    msgstr[2] "
    "
    msgstr[3] "
    "

    I translated this one online, exported the remaining untranslated strings, did them in Trados etc and this time the upload worked by and large. It did add another 11 empty strings such as

    We automatically scan your entire site every day for security threats and vulnerabilities. We'll thoroughly check for any suspicious activity or code, provide you with instant notifications and details when we find an issue, and help you resolve any harmful threats.↵

    It would seem that when Trados gets a unit that ends in a linebreak, it outputs that differently than it was inputted. Odd, maybe I should file a bug with Trados.

    I think I’ll translate those 11 online, that should allow me to deal with the rest of the strings without issues.

    btw, we’ll be able to help you quicker with these kind of problems in the WordPress.com translation community:
    <sigh> thanks… I’ve been involved in WP for many years now and I still find the setup confusing in terms of what’s where. I’ll bookmark that link.

    Thanks for your help!

  • The topic ‘importing po files’ is closed to new replies.