Search code examples
phpgettextpopoeditxgettext

Poedit : "Source code not available error" for Html/Html5 files


I get a "Source code not available error" whenever i try to extract from source an Html5 source file.

Note that when i change its extention to .php or try to extract from any php file, the existing source code is extracted without errors. Unfortunately, that option is not viable.

Here is the Catalogue properties where the source file paths are configured :

Capture

This is the resulting error when trying to extract the source code so that it can be translated in poedit:

Capture


Solution

  • I solved the problem with the following steps:

    • First, Open Poedit and go to File->preferences

    step 1

    • Second, Click on the Extractors Tab and add a custom extractor with the plus sign on the bottom. Mine is already created as you see in the picture.

    step 2

    • Finally add the following values to the relevant fields:

    Field 1 = PHP

    Field 2 = ‪*.php;.html;.html5

    Field 3 = xgettext --language=PHP --add-comments=TRANSLATORS: --force-po -o %o %C %K %F

    Field 5 = ‪%f

    step 3

    And that is it. Hopefully you can now add your html or html5 file paths in the catalogue properties and enjoy the Poedit extraction features without any problem.