<?php
// locale: ?????????? (Ukrainian) (uk_UA)
// author: Mykola Pukhalskyi
/**
* returns ending for plural form of word by number and array of variants (1, 4, 5)
* example variants for apples ['??????', '??????', '?????']
*/
/**
* @param int $number
* @param array $endingArray
*
* @return string
*/
$getNumEnding = function ($number, array $endingArray)
{
$number = $number % 100;
if ($number >= 11 && $number <= 19)
{
return $endingArray[2];
}
$i = $number % 10;
switch ($i)
{
case (1):
$ending = $endingArray[0];
break;
case (2):
case (3):
case (4):
$ending = $endingArray[1];
break;
default:
$ending = $endingArray[2];
}
return $ending;
};
return array(
'months' => explode('_', '?????_??????_???????_??????_??????_??????_?????_??????_???????_??????_?????????_??????'),
'monthsNominative' => explode('_', '??????_?????_????????_???????_???????_???????_??????_???????_????????_???????_????????_???????'),
'monthsShort' => explode('_', '???_???_???_????_????_????_???_????_???_????_????_????'),
'weekdays' => explode('_', '?????????_????????_??????_??????_????????_??????_??????'),
'weekdaysShort' => explode('_', '??_??_??_??_??_??_??'),
'calendar' => array(
'sameDay' => '[????????]',
'nextDay' => '[??????]',
'lastDay' => '[?????]', // or "?????".
'lastWeek' => 'l',
'sameElse' => 'l',
'withTime' => function (\Moment\Moment $number)
{
return $number->format('G') == 11 ? '[??] H:i' : '[?] H:i';
},
'default' => 'd-m-Y',
),
'relativeTime' => array(
// 'future' => '? %s', // or "??"
'future' => function (\Moment\Moment $number)
{
return $number->format('G') == 11 ? '?? %s' : '? %s';
},
'past' => '%s ????',
's' => '?????? ??????',
'ss' => '?????? ??????', // needs review by native speaker see https://github.com/fightbulc/moment.php/issues/166
'm' => '???????',
'mm' => function ($number) use ($getNumEnding)
{
return $getNumEnding($number, array('%d ???????', '%d ???????', '%d ??????'));
},
'h' => '??????',
'hh' => function ($number) use ($getNumEnding)
{
return $getNumEnding($number, array('%d ??????', '%d ??????', '%d ?????'));
},
'd' => '????',
'dd' => function ($number) use ($getNumEnding)
{
return $getNumEnding($number, array('%d ????', '%d ???', '%d ????'));
},
'M' => '??????',
'MM' => function ($number) use ($getNumEnding)
{
return $getNumEnding($number, array('%d ??????', '%d ??????', '%d ???????'));
},
'y' => '???',
'yy' => function ($number) use ($getNumEnding)
{
return $getNumEnding($number, array('%d ???', '%d ????', '%d ?????'));
},
),
'ordinal' => function ($number)
{
$n = $number % 100;
$k = $number % 10;
$ends = array('-??', '-??', '-??', '-??', '-??', '-??', '-??', '-??', '-??', '-??');
if ($n >= 11 && $n <= 13)
{
return $number . '[th]';
}
if ($n != 13 && $k = 3) {
return $number . '[' . $ends[2] . ']';
}
return $number . '[' . $ends[$k] . ']';
},
'week' => array(
'dow' => 1, // Monday is the first day of the week.
'doy' => 4 // The week that contains Jan 4th is the first week of the year.
),
);
|