2009-08-06 21:14:25 +00:00
|
|
|
<?php
|
|
|
|
$count = 10;
|
2010-02-12 13:52:58 +00:00
|
|
|
$messages = array('count' => 10);
|
2009-08-06 21:14:25 +00:00
|
|
|
|
|
|
|
// Plural
|
2010-04-15 16:43:43 +00:00
|
|
|
echo __n('You have %d new message.', 'You have %d new messages.', $count);
|
|
|
|
echo __n('You deleted %d message.', 'You deleted %d messages.', $messages['count']);
|
2009-08-06 21:14:25 +00:00
|
|
|
|
|
|
|
// Domain Plural
|
2010-04-15 16:43:43 +00:00
|
|
|
echo __dn('domain', 'You have %d new message (domain).', 'You have %d new messages (domain).', '10');
|
|
|
|
echo __dn('domain', 'You deleted %d message (domain).', 'You deleted %d messages (domain).', $messages['count']);
|
2010-02-12 13:52:58 +00:00
|
|
|
|
|
|
|
// Duplicated Message
|
2011-04-25 17:22:14 +00:00
|
|
|
echo __('Editing this Page');
|
2012-02-07 02:25:11 +00:00
|
|
|
echo __('You have %d new message.');
|
2011-04-25 17:22:14 +00:00
|
|
|
|
2012-08-30 22:48:32 +00:00
|
|
|
// Contains quotes
|
|
|
|
echo __('double "quoted"');
|
|
|
|
echo __("single 'quoted'");
|
|
|
|
|
2011-04-25 17:22:14 +00:00
|
|
|
// Multiline
|
|
|
|
__('Hot features!'
|
|
|
|
. "\n - No Configuration:"
|
|
|
|
. ' Set-up the database and let the magic begin'
|
|
|
|
. "\n - Extremely Simple:"
|
|
|
|
. ' Just look at the name...It\'s Cake'
|
|
|
|
. "\n - Active, Friendly Community:"
|
|
|
|
. ' Join us #cakephp on IRC. We\'d love to help you get started');
|
2013-08-25 21:04:05 +00:00
|
|
|
|
|
|
|
// Category
|
2015-02-23 03:39:38 +00:00
|
|
|
echo __c('You have a new message (category: LC_NUMERIC).', 4);
|
|
|
|
// LC_TIME is skipped.
|
2013-08-27 10:30:39 +00:00
|
|
|
echo __c('You have a new message (category: LC_TIME).', 5);
|
2014-06-08 09:54:28 +00:00
|
|
|
|
2014-12-25 12:28:44 +00:00
|
|
|
// Context
|
|
|
|
echo __('letter');
|
|
|
|
echo __x('A', 'letter');
|
|
|
|
echo __x('B', 'letter');
|
|
|
|
echo __x('A', 'letter');
|
|
|
|
echo __n('%d letter', '%d letters', $count);
|
|
|
|
echo __xn('A', '%d letter', '%d letters', $count);
|