PHP Classes

File: infrastructure/libraries/Moment/Locales/uk_UA.php

Recommend this page to a friend!
  Classes of Maicon gonçalez   Potato Service   infrastructure/libraries/Moment/Locales/uk_UA.php   Download  
File: infrastructure/libraries/Moment/Locales/uk_UA.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Potato Service
Framework that extracts route details from classes
Author: By
Last change:
Date: 1 year ago
Size: 4,251 bytes
 

Contents

Class file image Download
<?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.
   
),
);