LanguageKaa.php 1.3 KB

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