Reduced some master queries by adding flags to Revision functions.
[lhc/web/wiklou.git] / languages / classes / LanguageKaa.php
1 <?php
2
3 /** Karakalpak (Qaraqalpaqsha)
4 *
5 * @ingroup Language
6 */
7 class LanguageKaa extends Language {
8
9 # Convert from the nominative form of a noun to some other case
10 # Invoked with {{GRAMMAR:case|word}}
11 /**
12 * Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms
13 *
14 * @param $word string
15 * @param $case string
16 *
17 * @return string
18 */
19 function convertGrammar( $word, $case ) {
20 global $wgGrammarForms;
21 if ( isset( $wgGrammarForms['kaa'][$case][$word] ) ) {
22 return $wgGrammarForms['kaa'][$case][$word];
23 }
24 /* Full code of function convertGrammar() is in development. Updates coming soon. */
25 return $word;
26 }
27
28 /**
29 * It fixes issue with ucfirst for transforming 'i' to 'İ'
30 *
31 * @param $string string
32 *
33 * @return string
34 */
35 function ucfirst ( $string ) {
36 if ( substr( $string, 0, 1 ) === 'i' ) {
37 return 'İ' . substr( $string, 1 );
38 } else {
39 return parent::ucfirst( $string );
40 }
41 }
42
43 /**
44 * It fixes issue with lcfirst for transforming 'I' to 'ı'
45 *
46 * @param $string string
47 *
48 * @return mixed|string
49 */
50 function lcfirst ( $string ) {
51 if ( substr( $string, 0, 1 ) === 'I' ) {
52 return 'ı' . substr( $string, 1 );
53 } else {
54 return parent::lcfirst( $string );
55 }
56 }
57
58 /**
59 * Avoid grouping whole numbers between 0 to 9999
60 *
61 * @param $_ string
62 *
63 * @return string
64 */
65 function commafy( $_ ) {
66 if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
67 return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
68 } else {
69 return $_;
70 }
71 }
72
73 }