English
|
German | Add yours here
I18n
Current locale (echo I18n::getLocale();
): English [en]
Let's try to translate something.
echo __('A simple string.');
A translated version of a simple string.
Using Placeholders
echo __('Hello, my name is {0}, I\'m {1} years old.', ['Sara', 12]);
Hello, my name is Sara, I'm 12 years old.
Complex placeholders
(Experimental - most doesn't seem to work properly in PHP5.4)
echo __('You have traveled {0,number,decimal} kilometers in {1,number,integer} weeks.', [5423.344, 5.1]);
You have traveled decimal5423 kilometers in 5 weeks.
echo __('Your balance on the {0,date} is {1,number,currency}. {2,number,percent} more.', [strtotime('2014-01-13 11:12:00'), 1354.376], 0.02);
Your balance on the Jan 13, 2014 is ยค1,354.38. 2% more.Note that the strtotime() call is necessary for PHP < 5.5.