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.
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.
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.
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.
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.
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.
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’
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 ?
A fix was implemented to make sure that translation files for .pot source files will always have a .po extension instead of .pot. So, what this means is that you can use either .po or .pot source files now and always get back translation files with a .po extension.