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

Just playing with the HTML…

Login

Blog History

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 *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.