<?php
/**
* Returns months names for current language
* @return array
*/
function lang_months() {
return [
'yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun',
'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'
];
}
/**
* Returns days names for current language
* @return array
*/
function lang_days() {
return [
'b', 'be', 'ça', 'ç', 'ca', 'c', 'ş'
];
}
/**
* Returns date for current language
* @param string $date_string
* @return string
*/
function lang_date($date_string) {
$eng_months = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
];
return str_replace($eng_months, lang_months
(), $date_string); }
/**
* Converts string from current language to SLUG
* @param string $string Input string
* @param boolean $disallow_numeric Disallow numeric SLUG
* @return string
*/
function lang_slug($string, $disallow_numeric = true) {
$slug = trim($slug, '-');
$ru_en = [
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd',
'е' => 'e', 'ё' => 'yo', 'ж' => 'zh', 'з' => 'z',
'и' => 'i', 'й' => 'i', 'к' => 'k', 'л' => 'l', 'м' => 'm',
'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's',
'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c',
'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch', 'ъ' => '', 'ы' => 'y',
'ь' => '', 'э' => 'e', 'ю' => 'yu', 'я' => 'ja', 'ə' => 'e',
'ş' => 's', 'ı' => 'i', 'ç' => 'c', 'ü' => 'u', 'ö' => 'o',
'ğ' => 'g',
];
$slug = strtr($slug, $ru_en);
if (!$slug) {
$slug = 'untitled';
}
}
return $slug;
}
/**
* Set locale information
* @return mixed
*/
function lang_setlocale() {
$locale = 'ru_RU.UTF-8';
}
return true;
}
/**
* Locale name
*/
define('LC_LANGUAGE_TERRITORY', 'ru_RU');
/**
* Locale validate regexp
*/
define('LC_LANGUAGE_VALIDATE_REGEXP', "/^([a-zа-яёй0-9 \.\?\@\,\-]*)$/ui");