I thought double underscore always meant private function but what does it mean in cakephp 2.0 in such examples as this http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
For example
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
Strictly speaking, it means nothing in PHP as it is not a pre-defined function. However, in many frameworks, like CakePHP, and other libraries the double underscore is a function used for translating strings based on the user's language/locale preference.
PHP functions that start with a double underscore – a “__” – are called magic functions in PHP. They are functions that are always defined inside classes, and are not stand-alone functions.
The double underscore function in CakePHP handles localization. It's used when you want to translate your application by providing a string translation dictionary.
Cake PHP Book: Global Constants & Functions
See also Internationalization and Localization
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With