Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP gettext: not all strings becomes translated

Tags:

php

gettext

I have these two adjacent lines of code:

<td><?php echo __('Product', 'wpsc'); ?>:</td>
<td><?php echo __('Quantity', 'wpsc'); ?>:</td>

And these translations in the .po file

msgid "Product"   // Translates
msgstr "Produkt"

msgid "Quantity"  // does not translate
msgstr "Antall"

One string shows up translated on the webpage, the other not. And, yes I have tried to change the translation of the first one and confirmed that the translation changes accordingly, so I know the server reads the correct .mo file. This is on an up to date Ubuntu server. Any idea about what may be the problem?

like image 355
O A Olsen Avatar asked Apr 20 '10 17:04

O A Olsen


1 Answers

As Mark mentioned in his comment, check for the line #, fuzzy above the Quantity definition. gettext won't translate fuzzy strings.

(I'm adding this as an answer so it can get up voted, so that this question gets out of the unanswered queue)

like image 126
Peter Ajtai Avatar answered Oct 01 '22 13:10

Peter Ajtai