CakePhp i18n translation words in .po files

I am currently seeing this:

<span style="color: #2363a2;"><?php echo __('Accèdez à tous les %spronostics%s d\'%s', '<span style="font-weight: bold; text-transform: uppercase">', '</span>', AppController::getSiteName()); ?></span>

      

In my .po file I have this:

msgid "Accèdez à tous les %spronostics%s d'%s"
msgstr "Reach all the %s %spicks%s"

      

The translation I got (from french - msgid - to english - msgstr -) is not correct.

The value of the 1st% s in msgstr should be the value of the 3rd% s in. I've done some research related to i18n for cakephp but I haven't found anything related to my problem.

Do you know how to "reorder" translated% s?

Thank.

+3


source to share


1 answer


I've had problems in the past when passing replacement arguments as multiple arguments to a function. Using an array tends to be more reliable: -

__(
    'Accèdez à tous les %spronostics%s d\'%s', 
    [
        '<span style="font-weight: bold; text-transform: uppercase">', 
        '</span>', 
        AppController::getSiteName()
    ]
)

      

Update:



You need to specify the correct order in the translated string like this: -

msgid "Accèdez à tous les %spronostics%s d'%s"
msgstr "Reach all the %3$s %1$spicks%2$s"

      

Usage %3$s

tells Cake which parameter to use, where an integer represents the original ordering.

+1


source







All Articles