Search code examples
weblate

Why doesn't weblate recognize my pot file?


I'm using a hosted weblate.

I'm in the "Files" section of my component configuration. Below is my setup.


Translation files:

  • File format: gettext PO file
  • Filemask: src/translations/*.po
  • Language filter: ^[^.]+$

Monolingual translations:

  • All fields empty
  • Edit base file checked

Adding new languages:

  • Template for new translations: src/translations/template.pot
  • Adding new translation: Create new language file
  • Language code style: Default based on the file format

I can't validate these settings, I have an error below fields "Template for new translations" and "Adding new translation": The error is "Unrecognized base file for new translations".

I'm am 100% sure the pot file exists on the branch weblate is configured to use and also on master and that the path is correct.

Here are the first few lines of the pot file:

"Content-Type: text/plain; charset=UTF-8\n"

#: src/screens/CardList/CardList.texts.js:9
msgctxt "CardList"
msgid "hello"
msgstr ""

#: src/screens/CardList/CardList.texts.js:11
msgctxt "CardList"
msgid "cards"
msgstr ""

I don't understand what is happening, am I doing something wrong ?


Solution

  • The header of the file seems stripped. At least you should prepend following to make it syntactically valid:

    msgid ""
    msgstr ""
    

    See https://github.com/WeblateOrg/weblate/blob/master/weblate/locale/django.pot for real life POT file