You'll have to use the 'Localization' features of CakePHP
http://book.cakephp.org/2.0/en/core-libraries/internationalization-and-localization.html
Basically, any string that should be translated in the current language, should be echoed via the __()
method, for example echo __('hello')
The string 'hello' in this example is the string to be localised (translated). CakePHP uses GNU locale files to define your translations. In these files are 'pairs' of strings, called msgid
(the string/message to be translated) and msgstr
(the translated string). Each language ('locale') has its own translation file, located in:
app/Locale/[locale]/LC_MESSAGES/default.po
For example, to have a 'Dutch' translation (locale 'nld'), this file:
app/Locale/nld/LC_MESSAGES/default.po
Should be created, containing:
msgid "hello"
msgstr "hallo"
Now, by switching the locale to 'nld' (for example in the beforeFilter()
of your AppController;
Configure::write('Config.language', 'nld');
The 'nld' locale will be used and this line;
echo _('hello');
Will output:
hallo
In your case, setting the label would be something like this;
echo $this->Form->input('name', array('label' => __('hello')));
important
older versions (before CakePHP 2.x) 'echoed' the translated string in stead of returning the translated string. To return the translated string in CakePHP 1.x, you need to pass 'true' as second parameter; echo __('hello', true);
Strings in .po files are case sensitive, e.g. Hello !== hello
Locale files are meant for 'short', fixed text in your application, not to translate big pieces of text or 'dynamic' text, entered by the user. although it is possible to use it for these situations, it is not designed for this.
There are several other changes between CakePHP 2.x and 1.x, so in all cases, make yourself familiar with the whole concept by reading the manual.