Dušan Tichý
Dušan Tichý

Reputation: 518

cakePHP 3.3 internationalization

How can I set multiple language in case text is in array?

I know that if I use this

<?= __('username')?>

and in directory /src/Locale/de_DE/default.po I have written following

msgid "username"
msgstr "benutzer"

It's gonna change username to benutzer if I set language to de_DE (german)


But what to do if I have this

<?= $this->Form->input('password',['label' =>'Password']); ?>

and I would like to change label Password

Upvotes: 1

Views: 76

Answers (1)

JvO
JvO

Reputation: 3106

Simple:

$this->Form->input('password', ['label' => __('Password')]);

The __() function simply returns the translated string (more info). In your example you used

<?= ... ?>

which is equivalent to

<?php echo ... ?>

Upvotes: 2

Related Questions