wiki.techinc.nl/languages/classes/LanguageUk.php
Amir E. Aharoni 58612ee9fa Move the Ukrainian grammar rules from PHP and JS to JSON
Bug: T115217
Change-Id: I15a06b07e381cc9074e64e746d22ec51e9e638c4
2016-12-18 11:10:16 +00:00

48 lines
1.3 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Ukrainian (українська мова) specific code.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Language
*/
/**
* Ukrainian (українська мова)
*
* @ingroup Language
*/
class LanguageUk extends Language {
/**
* Ukrainian numeric format is "12 345,67" but "1234,56"
*
* @param string $_
*
* @return string
*/
function commafy( $_ ) {
if ( !preg_match( '/^\-?\d{1,4}(\.\d+)?$/', $_ ) ) {
return strrev( (string)preg_replace(
'/(\d{3})(?=\d)(?!\d*\.)/',
'$1,',
strrev( $_ )
) );
} else {
return $_;
}
}
}