Existing translations not fetched with github integration

Hello, I’ve configured the github integration on a project which already contains partial translations for some languages in the github repo, as po files. I made a new transifex project to test it out. The source files are synced okay, but the translations aren’t there. Should transifex have automatically picked these up and I’m doing something wrong, or is that not expected behaviour?

In case it helps my config looks like (and I verified the path to the translation files is correct):

filters:
  - filter_type: dir
    file_format: PO
    source_file_extension: pot
    source_language: en
    source_file_dir: docs/locale/en/LC_MESSAGES/
    translation_files_expression: 'docs/locale/<lang>/LC_MESSAGES/'
settings:
    pr_branch_name: tx_translations_<br_unique_id>

Edit: is it a problem that the source files are pot and the translation files are po extension? If I change the extension to po I get “Error while uploading translation: ‘Not found’” for every single translation file, and none of the source files show. It is looking in the right place for po files which do exist, though.

Thanks!

1 Like

Further testing and I can see that it’s making the PRs with translations to .pot files when they should be .po files, so I think this discrepancy must have something to do with it…

I tried changing the source files to .po, but that didn’t help with finding the existing translations.

1 Like

Hello @rhiaro ,

Thank you for reaching out to the Transifex community.

Could you please share with us the URL of your test project, in order to test this out?
Also, you can reach out to us via email at support@transifex.com in order to continue the discussion from there.

Looking forward to your response.

Kind regards,
Panagiotis

Thanks for your reply @Panagiotis_Kavrakis, the test project is BODS test localization. I can send an email, but I’m happy to continue here so that the responses can help others who are searching similar problems in the future.

Hello @rhiaro ,

Thank you for your response. I will have a further look into this and I will let you know as soon as possible.

Kind regards,
Panagiotis

Hello @rhiaro ,

Let me chime in here since Panagiotis is out of the office.
Basing on your initial query I assume your PO files (translations) contains some strings translated and some others are empty, PO format does not allow partial translations meaning that you either have all of them filled or all of them empty.

e.g.
PO file fromat:

msgid “Next”
msgstr “Next”
msgid “Done”
msgstr “Done”

POT file format:
msgid “Next”
msgstr “”
msgid “Done”
msgstr “”

If this is not clear perhaps you could share your PO file with us so we can go over it and point out the root cause :slight_smile:
Best Regards
Cesar

1 Like

Thanks @Cesar_Garcia. Most, if not all, of the files in one language are fully translated: data-standard/docs/locale/ru/LC_MESSAGES at master · openownership/data-standard · GitHub

This also doesn’t explain the problem with the file extension. I understand it is normal to use .pot for the source files, and .po for the translated files. So should I put pot or po as the value for source_file_extension in the config? If I use .pot (which is the extension for the source files) then when the github integration makes a PR with new translations (for a fully translated resource), it creates .pot files for the translations, which should not be the case, especially as there are existing .po files in the repo.

Hello Rhiaro,

I hope you are doing great!

I believe there is a misunderstanding on how the integrations works,
I noticed that on your initial query you pasted your YAML config and you are using :

  • filter_type: dir

By using this option Transifex will get the file name + extension and will use it on your translation files, POT is just a structure template of the PO file format, Now, You can use PO for source or POT that is really up to you just keep in mind that while using file_type dir you wont be able to change or customize your file name or its format.

Using the below YAML config I get a POT file for source and a POT file return as a translation and as you can see I added the extension next to the variable “lang”
git:
filters:

  • filter_type: file
    file_format: PO
    source_file: locale/test.pot
    source_language: en
    translation_files_expression: ‘.pot’

Let me know if the above answers your question :slight_smile:
Best Regards
Cesar

By using this option Transifex will get the file name + extension

Get from where?

I think I must use filter_type: dir because there are many resources to translate across many files, not only one file, correct?

I’m very sorry I don’t really understand your reply. What configuration do I need for:

  • a github repo that already has translations, where
  • I want the first sync to fetch the existing translations into transifex;
  • the source files have .pot extensions,
  • and the translation files have .po extensions;
  • and subsequent translations/changes in transifex should be made as PRs against the corresponding translation .po files that are already in the repo?

Thanks again for your help.

Hello,

I apologize for the delay, I was doing some testing in one my projects and this is what I found:
Using the following YML configuration and having POT as source and PO as translation, Im able to send all files (source & translations) to Transifex successfully this is only from GH to TX
git:
filters:
- filter_type: dir
file_format: PO
source_file_extension: pot
source_language: en
source_file_dir: SourceFiles
translation_files_expression: ‘Translations//’

Now, For the second sync Transifex will return translation files as POT and here is what I meant by “Transifex will get the file name + extension” from your source files. Im not completely sure this is the right behavior and I keep looking into this with the relevant team as working from the UI you can upload a POT as source and you will get a PO in return as a translation download. so, In the mean time in order to avoid loosing more time, is it possible for you to upload all your source files as PO ?

Thanks in advance
Cesar