-1

I'm trying to localize my php app that uses .ctp files for the views.

Here a sample of a file's content:

<h2><?php __('Menu');?></h2>
<table >
<tr >
    <td  style="text-align:left>
        <?php echo $html->link('Main Config','/admin/configs/index')?>
    </td>
</tr>

PS: this is not my code and I cannot change it - but I need to translate it!

I tried following threads using POEdit and tried this solution, which however seems to be on a previous version of POEdit...

So I created a new po file for de-DE in my root directory (standard encoddings, ...), opened the catalog's preferences and added . and one specific /subdir/test.ctp file containing above code) to my source paths, then added _ and __ to the additional keywords (as well as some others I found to contain some text such as input and link, for example).

Then, whether I use update, update from source, no string is found - it says "Translated 0 from 0 (0%)"...

What am I doing wrong here?

NOTE: this is on a windows 10 pc with only POEdit installed, I didn't install php nor php-gettext installed directly on my machine, but they're supposed to be embedded in POEdit from what I could read...

neggenbe
  • 1,697
  • 2
  • 24
  • 62
  • Which version of CakePHP are you using? How are you setting up the `locale` setting for your application? Have you used the `i18n shell` as [described here](https://book.cakephp.org/3.0/en/console-and-shells/i18n-shell.html)? To me it looks like you are missing steps. The POEdit is just an intermediarry step in the process. Depending on your setup it may be the last one. So it will not work just by itself. – Ilie Pandia May 10 '18 at 10:21

1 Answers1

-1

.ctp extension is not recognized by GNU gettext's xgettext as a PHP extension — such files are skipped over. I just added special treatment for it to Poedit a week ago, so it will be fine in Poedit ≥ 2.0.8.

Until then, you can add a custom extractor (using the same syntax as in Poedit 1, see the placeholder examples in the window where you enter it) for *.ctp files.

Václav Slavík
  • 6,445
  • 2
  • 28
  • 25
  • Could you please advise as to where I can find the windows release of the latest release (found 2.0.7 on your website) and, until then, where, in previous version, I can edit "extractors"? Thanks!!! – neggenbe May 11 '18 at 14:50
  • I just upgraded but the I'm absolutely not able to create a project to update from ctp sources... Did you post a tutorial somewhere, or can you provide a sample pot file I can modify? – neggenbe Jun 21 '18 at 13:31
  • @neggenbe Nothing special is needed for *.ctp handling in v2.0.8+. Just standard setup that Google has a gazillion tutorials for ("poedit tutorial"). If you're seeing some problems, see http://www.chiark.greenend.org.uk/~sgtatham/bugs.html – Václav Slavík Jun 28 '18 at 16:41