MediaWiki  1.23.2
LanguageKu.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/../LanguageConverter.php';
25 require_once __DIR__ . '/LanguageKu_ku.php';
26 
32 class KuConverter extends LanguageConverter {
34  'ب' => 'b', 'ج' => 'c', 'چ' => 'ç', 'د' => 'd', 'ف' => 'f', 'گ' => 'g', 'ھ' => 'h',
35  'ہ' => 'h', 'ه' => 'h', 'ح' => 'h', 'ژ' => 'j', 'ك' => 'k', 'ک' => 'k', 'ل' => 'l',
36  'م' => 'm', 'ن' => 'n', 'پ' => 'p', 'ق' => 'q', 'ر' => 'r', 'س' => 's', 'ش' => 'ş',
37  'ت' => 't', 'ڤ' => 'v', 'خ' => 'x', 'غ' => 'x', 'ز' => 'z',
38 
39 // ک و => ku -- ist richtig
40 // و ك=> ku -- ist auch richtig
41 
42  /* Doppel- und Halbvokale */
43  'ڵ' => 'll', # ll
44  'ڕ' => 'rr', # rr
45  'ا' => 'a',
46  # 'ئێ' => 'ê', # initial e
47  'ە' => 'e',
48  'ه‌' => 'e', # with one non-joiner
49  'ه‌‌' => 'e', # with two non-joiner
50  'ة' => 'e',
51  'ێ' => 'ê',
52  'ي' => 'î',
53  'ی' => 'î', # U+06CC db 8c ARABIC LETTER FARSI YEH
54  'ى' => 'î', # U+0649 d9 89 ARABIC LETTER ALEF MAKSURA
55  'ۆ' => 'o',
56  'و' => 'w',
57  'ئ' => '', # initial hemze should not be shown
58  '،' => ',',
59  'ع' => '\'', # ayn
60  '؟' => '?',
61 
62  # digits
63  '٠' => '0', # &#x0660;
64  '١' => '1', # &#x0661;
65  '٢' => '2', # &#x0662;
66  '٣' => '3', # &#x0663;
67  '٤' => '4', # &#x0664;
68  '٥' => '5', # &#x0665;
69  '٦' => '6', # &#x0666;
70  '٧' => '7', # &#x0667;
71  '٨' => '8', # &#x0668;
72  '٩' => '9', # &#x0669;
73  );
74 
76  'b' => 'ب', 'c' => 'ج', 'ç' => 'چ', 'd' => 'د', 'f' => 'ف', 'g' => 'گ',
77  'h' => 'ه', 'j' => 'ژ', 'k' => 'ک', 'l' => 'ل',
78  'm' => 'م', 'n' => 'ن', 'p' => 'پ', 'q' => 'ق', 'r' => 'ر', 's' => 'س', 'ş' => 'ش',
79  't' => 'ت', 'v' => 'ڤ',
80  'x' => 'خ', 'y' => 'ی', 'z' => 'ز',
81 
82  'B' => 'ب', 'C' => 'ج', 'Ç' => 'چ', 'D' => 'د', 'F' => 'ف', 'G' => 'گ', 'H' => 'ھ',
83  'H' => 'ہ', 'H' => 'ه', 'H' => 'ح', 'J' => 'ژ', 'K' => 'ك', 'K' => 'ک', 'L' => 'ل',
84  'M' => 'م', 'N' => 'ن', 'P' => 'پ', 'Q' => 'ق', 'R' => 'ر', 'S' => 'س', 'Ş' => 'ش',
85  'T' => 'ت', 'V' => 'ڤ', 'W' => 'و', 'X' => 'خ',
86  'Y' => 'ی', 'Z' => 'ز',
87 
88  /* Doppelkonsonanten */
89  # 'll' => 'ڵ', # wenn es geht, doppel-l und l getrennt zu behandeln
90  # 'rr' => 'ڕ', # selbiges für doppel-r
91 
92  /* Einzelne Großbuchstaben */
93  // ' C' => 'ج',
94 
95  /* Vowels */
96  'a' => 'ا',
97  'e' => 'ە',
98  'ê' => 'ێ',
99  'i' => '',
100  'î' => 'ی',
101  'o' => 'ۆ',
102  'u' => 'و',
103  'û' => 'وو',
104  'w' => 'و',
105  ',' => '،',
106  '?' => '؟',
107 
108  # Try to replace the leading vowel
109  ' a' => 'ئا ',
110  ' e' => 'ئە ',
111  ' ê' => 'ئێ ',
112  ' î' => 'ئی ',
113  ' o' => 'ئۆ ',
114  ' u' => 'ئو ',
115  ' û' => 'ئوو ',
116  'A' => 'ئا',
117  'E' => 'ئە',
118  'Ê' => 'ئێ',
119  'Î' => 'ئی',
120  'O' => 'ئۆ',
121  'U' => 'ئو',
122  'Û' => 'ئوو',
123  ' A' => 'ئا ',
124  ' E' => 'ئە ',
125  ' Ê' => 'ئێ ',
126  ' Î' => 'ئی ',
127  ' O' => 'ئۆ ',
128  ' U' => 'ئو ',
129  ' Û' => 'ئوو ',
130  # eyn erstmal deaktivieren, einfache Anführungsstriche sind einfach zu häufig, um sie als eyn zu interpretieren
131  # '\'' => 'ع',
132 
133 /* # deactivated for now, breaks links i.e. in header of Special:Recentchanges :-(
134  # digits
135  '0' => '٠', # &#x0660;
136  '1' => '١', # &#x0661;
137  '2' => '٢', # &#x0662;
138  '3' => '٣', # &#x0663;
139  '4' => '٤', # &#x0664;
140  '5' => '٥', # &#x0665;
141  '6' => '٦', # &#x0666;
142  '7' => '٧', # &#x0667;
143  '8' => '٨', # &#x0668;
144  '9' => '٩', # &#x0669;
145 */
146  );
147 
148  function loadDefaultTables() {
149  $this->mTables = array(
150  'ku-latn' => new ReplacementArray( $this->mArabicToLatin ),
151  'ku-arab' => new ReplacementArray( $this->mLatinToArabic ),
152  'ku' => new ReplacementArray()
153  );
154  }
155 
166  function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
167  // check for user namespace
168  if ( is_object( $nt ) ) {
169  $ns = $nt->getNamespace();
170  if ( $ns == NS_USER || $ns == NS_USER_TALK ) {
171  return;
172  }
173  }
174 
175  $oldlink = $link;
176  parent::findVariantLink( $link, $nt, $ignoreOtherCond );
177  if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) {
178  $link = $oldlink;
179  }
180  }
181 
191  function autoConvert( $text, $toVariant = false ) {
193  if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) {
194  $imagename = $wgTitle->getNsText();
195  if ( preg_match( "/^$imagename:/", $text ) ) {
196  return $text;
197  }
198  }
199  return parent::autoConvert( $text, $toVariant );
200  }
201 
212  function translate( $text, $toVariant ) {
213  $this->loadTables();
214  /* From Kazakh interface, maybe we need it later
215  $breaks = '[^\w\x80-\xff]';
216  // regexp for roman numbers
217  $roman = 'M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})';
218  $roman = '';
219 
220  $reg = '/^'.$roman.'$|^'.$roman.$breaks.'|'.$breaks.$roman.'$|'.$breaks.$roman.$breaks.'/';
221 
222  $matches = preg_split($reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
223 
224  $m = array_shift($matches);
225  if( !isset( $this->mTables[$toVariant] ) ) {
226  throw new MWException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) );
227  }
228  $ret = $this->mTables[$toVariant]->replace( $m[0] );
229  $mstart = $m[1]+strlen($m[0]);
230  foreach($matches as $m) {
231  $ret .= substr($text, $mstart, $m[1]-$mstart);
232  $ret .= parent::translate($m[0], $toVariant);
233  $mstart = $m[1] + strlen($m[0]);
234  }
235 
236  return $ret;
237  */
238 
239  if ( !isset( $this->mTables[$toVariant] ) ) {
240  throw new MWException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) );
241  }
242 
243  return parent::translate( $text, $toVariant );
244  }
245 }
246 
252 class LanguageKu extends LanguageKu_ku {
253 
254  function __construct() {
256  parent::__construct();
257 
258  $variants = array( 'ku', 'ku-arab', 'ku-latn' );
259  $variantfallbacks = array(
260  'ku' => 'ku-latn',
261  'ku-arab' => 'ku-latn',
262  'ku-latn' => 'ku-arab',
263  );
264 
265  $this->mConverter = new KuConverter( $this, 'ku', $variants, $variantfallbacks );
266  $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
267  }
268 }
KuConverter\loadDefaultTables
loadDefaultTables()
Definition: LanguageKu.php:148
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
KuConverter\findVariantLink
findVariantLink(&$link, &$nt, $ignoreOtherCond=false)
A function wrapper:
Definition: LanguageKu.php:166
Language\$mConverter
LanguageConverter $mConverter
Definition: Language.php:78
NS_FILE
const NS_FILE
Definition: Defines.php:85
e
in this case you re responsible for computing and outputting the entire conflict i e
Definition: hooks.txt:1038
$wgHooks
$wgHooks['ArticleShow'][]
Definition: hooks.txt:110
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2149
LanguageKu\__construct
__construct()
Definition: LanguageKu.php:254
MWException
MediaWiki exception.
Definition: MWException.php:26
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
LanguageKu_ku
Kurdish.
Definition: LanguageKu_ku.php:29
KuConverter\autoConvert
autoConvert( $text, $toVariant=false)
An ugly function wrapper for parsing Image titles (to prevent image name conversion)
Definition: LanguageKu.php:191
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:82
ReplacementArray
Replacement array for FSS with fallback to strtr() Supports lazy initialisation of FSS resource.
Definition: StringUtils.php:411
KuConverter\translate
translate( $text, $toVariant)
It translates text into variant, specials:
Definition: LanguageKu.php:212
KuConverter
Kurdish converter routines.
Definition: LanguageKu.php:32
LanguageKu
Kurdish (Kurdî / كوردی)
Definition: LanguageKu.php:252
Makefile.translate
def translate(text, conv_table)
Definition: Makefile.py:216
KuConverter\$mLatinToArabic
$mLatinToArabic
Definition: LanguageKu.php:75
NS_USER
const NS_USER
Definition: Defines.php:81
KuConverter\$mArabicToLatin
$mArabicToLatin
Definition: LanguageKu.php:33
$wgTitle
if(! $wgRequest->checkUrlExtension()) if(! $wgEnableAPI) $wgTitle
Definition: api.php:63