CakePHP – Do you want the internationalization? You can’t handle the internationalization!

Written by James McDonald

October 10, 2011

Just playing with the HTML Helper link method

Putting __() around a string makes it ready for internationalization in CakePHP. You create a translation file using poedit or somesuch and then CakePHP will automagically replace the contents with the other language when told to.

But discovered you can’t do this:

echo $this->Html->link( 
        __('Hello James')
         , 'https://toggen.com.au/blog');

You must add “, true” to tell it to return when it’s not being echoed.

echo $this->Html->link( 
        __('Hello James', true)
         , 'https://toggen.com.au/blog');

So if you see dead link text in your CakePHP application which uses __() then check to make sure you use __(‘Your Text’, true).

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

Toggen builds a new website

So I have built and hosted a new website for Roger Clark Pest Management they are a family owned and operated Pest...

WizTree

Just downloaded WizTree (not a sponsor) from https://wiztreefree.com/ It seems to do what it says on the tin which is...

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...