MediaWiki  1.23.12
LanguageIu.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/../LanguageConverter.php';
25 
38 class IuConverter extends LanguageConverter {
39 
40  protected $mDoContentConvert;
41  public $mToLatin = array(
42  'ᐦ' => 'h', 'ᐃ' => 'i', 'ᐄ' => 'ii', 'ᐅ' => 'u', 'ᐆ' => 'uu', 'ᐊ' => 'a', 'ᐋ' => 'aa',
43  'ᑉ' => 'p', 'ᐱ' => 'pi', 'ᐲ' => 'pii', 'ᐳ' => 'pu', 'ᐴ' => 'puu', 'ᐸ' => 'pa', 'ᐹ' => 'paa',
44  'ᑦ' => 't', 'ᑎ' => 'ti', 'ᑏ' => 'tii', 'ᑐ' => 'tu', 'ᑑ' => 'tuu', 'ᑕ' => 'ta', 'ᑖ' => 'taa',
45  'ᒃ' => 'k', 'ᑭ' => 'ki', 'ᑮ' => 'kii', 'ᑯ' => 'ku', 'ᑰ' => 'kuu', 'ᑲ' => 'ka', 'ᑳ' => 'kaa',
46  'ᖅᒃ' => 'qq', 'ᖅᑭ' => 'qqi', 'ᖅᑮ' => 'qqii', 'ᖅᑯ' => 'qqu', 'ᖅᑰ' => 'ᖅqquu', 'ᖅᑲ' => 'qqa', 'ᖅᑳ' => 'qqaa',
47  'ᒡ' => 'g', 'ᒋ' => 'gi', 'ᒌ' => 'gii', 'ᒍ' => 'gu', 'ᒎ' => 'guu', 'ᒐ' => 'ga', 'ᒑ' => 'gaa',
48  'ᒻ' => 'm', 'ᒥ' => 'mi', 'ᒦ' => 'mii', 'ᒧ' => 'mu', 'ᒨ' => 'muu', 'ᒪ' => 'ma', 'ᒫ' => 'maa',
49  'ᓐ' => 'n', 'ᓂ' => 'ni', 'ᓃ' => 'nii', 'ᓄ' => 'nu', 'ᓅ' => 'nuu', 'ᓇ' => 'na', 'ᓈ' => 'naa',
50  'ᔅ' => 's', 'ᓯ' => 'si', 'ᓰ' => 'sii', 'ᓱ' => 'su', 'ᓲ' => 'suu', 'ᓴ' => 'sa', 'ᓵ' => 'saa',
51  'ᓪ' => 'l', 'ᓕ' => 'li', 'ᓖ' => 'lii', 'ᓗ' => 'lu', 'ᓘ' => 'luu', 'ᓚ' => 'la', 'ᓛ' => 'laa',
52  'ᔾ' => 'j', 'ᔨ' => 'ji', 'ᔩ' => 'jii', 'ᔪ' => 'ju', 'ᔫ' => 'juu', 'ᔭ' => 'ja', 'ᔮ' => 'jaa',
53  'ᕝ' => 'v', 'ᕕ' => 'vi', 'ᕖ' => 'vii', 'ᕗ' => 'vu', 'ᕘ' => 'vuu', 'ᕙ' => 'va', 'ᕚ' => 'vaa',
54  'ᕐ' => 'r', 'ᕆ' => 'ri', 'ᕇ' => 'rii', 'ᕈ' => 'ru', 'ᕉ' => 'ruu', 'ᕋ' => 'ra', 'ᕌ' => 'raa',
55  'ᖅ' => 'q', 'ᕿ' => 'qi', 'ᖀ' => 'qii', 'ᖁ' => 'qu', 'ᖂ' => 'quu', 'ᖃ' => 'qa', 'ᖄ' => 'qaa',
56  'ᖕ' => 'ng', 'ᖏ' => 'ngi', 'ᖐ' => 'ngii', 'ᖑ' => 'ngu', 'ᖒ' => 'nguu', 'ᖓ' => 'nga', 'ᖔ' => 'ngaa',
57  'ᖖ' => 'nng', 'ᙱ' => 'nngi', 'ᙲ' => 'nngii', 'ᙳ' => 'nngu', 'ᙴ' => 'nnguu', 'ᙵ' => 'nnga', 'ᙶ' => 'nngaa',
58  'ᖦ' => 'ɫ', 'ᖠ' => 'ɫi', 'ᖡ' => 'ɫii', 'ᖢ' => 'ɫu', 'ᖣ' => 'ɫuu', 'ᖤ' => 'ɫa', 'ᖥ' => 'ɫaa',
59  );
60 
62  'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e',
63  'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j',
64  'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o',
65  'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't',
66  'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y',
67  'Z' => 'z',
68  );
69 
70  public $mToSyllabics = array(
71  'h' => 'ᐦ', 'i' => 'ᐃ', 'ii' => 'ᐄ', 'u' => 'ᐅ', 'uu' => 'ᐆ', 'a' => 'ᐊ', 'aa' => 'ᐋ',
72  'p' => 'ᑉ', 'pi' => 'ᐱ', 'pii' => 'ᐲ', 'pu' => 'ᐳ', 'puu' => 'ᐴ', 'pa' => 'ᐸ', 'paa' => 'ᐹ',
73  't' => 'ᑦ', 'ti' => 'ᑎ', 'tii' => 'ᑏ', 'tu' => 'ᑐ', 'tuu' => 'ᑑ', 'ta' => 'ᑕ', 'taa' => 'ᑖ',
74  'k' => 'ᒃ', 'ki' => 'ᑭ', 'kii' => 'ᑮ', 'ku' => 'ᑯ', 'kuu' => 'ᑰ', 'ka' => 'ᑲ', 'kaa' => 'ᑳ',
75  'g' => 'ᒡ', 'gi' => 'ᒋ', 'gii' => 'ᒌ', 'gu' => 'ᒍ', 'guu' => 'ᒎ', 'ga' => 'ᒐ', 'gaa' => 'ᒑ',
76  'm' => 'ᒻ', 'mi' => 'ᒥ', 'mii' => 'ᒦ', 'mu' => 'ᒧ', 'muu' => 'ᒨ', 'ma' => 'ᒪ', 'maa' => 'ᒫ',
77  'n' => 'ᓐ', 'ni' => 'ᓂ', 'nii' => 'ᓃ', 'nu' => 'ᓄ', 'nuu' => 'ᓅ', 'na' => 'ᓇ', 'naa' => 'ᓈ',
78  's' => 'ᔅ', 'si' => 'ᓯ', 'sii' => 'ᓰ', 'su' => 'ᓱ', 'suu' => 'ᓲ', 'sa' => 'ᓴ', 'saa' => 'ᓵ',
79  'l' => 'ᓪ', 'li' => 'ᓕ', 'lii' => 'ᓖ', 'lu' => 'ᓗ', 'luu' => 'ᓘ', 'la' => 'ᓚ', 'laa' => 'ᓛ',
80  'j' => 'ᔾ', 'ji' => 'ᔨ', 'jii' => 'ᔩ', 'ju' => 'ᔪ', 'juu' => 'ᔫ', 'ja' => 'ᔭ', 'jaa' => 'ᔮ',
81  'v' => 'ᕝ', 'vi' => 'ᕕ', 'vii' => 'ᕖ', 'vu' => 'ᕗ', 'vuu' => 'ᕘ', 'va' => 'ᕙ', 'vaa' => 'ᕚ',
82  'r' => 'ᕐ', 'ri' => 'ᕆ', 'rii' => 'ᕇ', 'ru' => 'ᕈ', 'ruu' => 'ᕉ', 'ra' => 'ᕋ', 'raa' => 'ᕌ',
83  'qq' => 'ᖅᒃ', 'qqi' => 'ᖅᑭ', 'qqii' => 'ᖅᑮ', 'qqu' => 'ᖅᑯ', 'qquu' => 'ᖅᑰ', 'qqa' => 'ᖅᑲ', 'qqaa' => 'ᖅᑳ',
84  'q' => 'ᖅ', 'qi' => 'ᕿ', 'qii' => 'ᖀ', 'qu' => 'ᖁ', 'quu' => 'ᖂ', 'qa' => 'ᖃ', 'qaa' => 'ᖄ',
85  'ng' => 'ᖕ', 'ngi' => 'ᖏ', 'ngii' => 'ᖐ', 'ngu' => 'ᖑ', 'nguu' => 'ᖒ', 'nga' => 'ᖓ', 'ngaa' => 'ᖔ',
86  'nng' => 'ᖖ', 'nngi' => 'ᙱ', 'nngii' => 'ᙲ', 'nngu' => 'ᙳ', 'nnguu' => 'ᙴ', 'nnga' => 'ᙵ', 'nngaa' => 'ᙶ',
87  'ɫ' => 'ᖦ', 'ɫi' => 'ᖠ', 'ɫii' => 'ᖡ', 'ɫu' => 'ᖢ', 'ɫuu' => 'ᖣ', 'ɫa' => 'ᖤ', 'ɫaa' => 'ᖥ',
88  );
89 
90  function loadDefaultTables() {
91  $this->mTables = array(
92  'lowercase' => new ReplacementArray( $this->mUpperToLowerCaseLatin ),
93  'ike-cans' => new ReplacementArray( $this->mToSyllabics ),
94  'ike-latn' => new ReplacementArray( $this->mToLatin ),
95  'iu' => new ReplacementArray()
96  );
97  }
98 
109  function parseManualRule( $rule, $flags = array() ) {
110  if ( in_array( 'T', $flags ) ) {
111  return parent::parseManualRule( $rule, $flags );
112  }
113 
114  $carray = array();
115  // otherwise ignore all formatting
116  foreach ( $this->mVariants as $v ) {
117  $carray[$v] = $rule;
118  }
119 
120  return $carray;
121  }
122 
130  function parserConvert( $text, &$parser ) {
131  $this->mDoContentConvert = !( is_object( $parser->getTitle() ) && $parser->getTitle()->isTalkPage() );
132 
133  return parent::parserConvert( $text, $parser );
134  }
135 
146  function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
147  // check for user namespace
148  if ( is_object( $nt ) ) {
149  $ns = $nt->getNamespace();
150  if ( $ns == NS_USER || $ns == NS_USER_TALK ) {
151  return;
152  }
153  }
154 
155  $oldlink = $link;
156  parent::findVariantLink( $link, $nt, $ignoreOtherCond );
157  if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) {
158  $link = $oldlink;
159  }
160  }
161 
171  function autoConvert( $text, $toVariant = false ) {
173  if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) {
174  $imagename = $wgTitle->getNsText();
175  if ( preg_match( "/^$imagename:/", $text ) ) {
176  return $text;
177  }
178  }
179  return parent::autoConvert( $text, $toVariant );
180  }
181 
190  function translate( $text, $toVariant ) {
191  // If $text is empty or only includes spaces, do nothing
192  // Otherwise translate it
193  if ( trim( $text ) ) {
194  $this->loadTables();
195  // To syllabics, first translate uppercase to lowercase Latin
196  if ( $toVariant == 'ike-cans' ) {
197  $text = $this->mTables['lowercase']->replace( $text );
198  }
199  $text = $this->mTables[$toVariant]->replace( $text );
200  }
201  return $text;
202  }
203 }
204 
210 class LanguageIu extends Language {
211  function __construct() {
213 
214  parent::__construct();
215 
216  $variants = array( 'iu', 'ike-cans', 'ike-latn' );
217  $variantfallbacks = array(
218  'iu' => 'ike-cans',
219  'ike-cans' => 'iu',
220  'ike-latn' => 'iu',
221  );
222 
223  $flags = array();
224  $this->mConverter = new IuConverter( $this, 'iu', $variants, $variantfallbacks, $flags );
225  $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
226  }
227 }
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
Language\$mConverter
LanguageConverter $mConverter
Definition: Language.php:78
NS_FILE
const NS_FILE
Definition: Defines.php:85
$wgHooks
$wgHooks['ArticleShow'][]
Definition: hooks.txt:110
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2118
$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:2154
IuConverter\$mUpperToLowerCaseLatin
$mUpperToLowerCaseLatin
Definition: LanguageIu.php:61
IuConverter\findVariantLink
findVariantLink(&$link, &$nt, $ignoreOtherCond=false)
A function wrapper:
Definition: LanguageIu.php:146
$parser
do that in ParserLimitReportFormat instead $parser
Definition: hooks.txt:1961
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
IuConverter\$mToLatin
$mToLatin
Definition: LanguageIu.php:41
IuConverter\autoConvert
autoConvert( $text, $toVariant=false)
An ugly function wrapper for parsing Image titles (to prevent image name conversion)
Definition: LanguageIu.php:171
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
IuConverter\parseManualRule
parseManualRule( $rule, $flags=array())
rules should be defined as -{Syllabic | Latin-} -or- -{code:text | code:text | ......
Definition: LanguageIu.php:109
IuConverter\translate
translate( $text, $toVariant)
It translates text into variant.
Definition: LanguageIu.php:190
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
NS_USER
const NS_USER
Definition: Defines.php:81
IuConverter
Conversion script between Latin and Syllabics for Inuktitut.
Definition: LanguageIu.php:38
LanguageIu
Inuktitut.
Definition: LanguageIu.php:210
IuConverter\$mDoContentConvert
$mDoContentConvert
Definition: LanguageIu.php:40
IuConverter\loadDefaultTables
loadDefaultTables()
Definition: LanguageIu.php:90
LanguageIu\__construct
__construct()
Definition: LanguageIu.php:211
Language
Internationalisation code.
Definition: Language.php:74
$wgTitle
if(! $wgRequest->checkUrlExtension()) if(! $wgEnableAPI) $wgTitle
Definition: api.php:63
IuConverter\parserConvert
parserConvert( $text, &$parser)
Do not convert content on talk pages.
Definition: LanguageIu.php:130
IuConverter\$mToSyllabics
$mToSyllabics
Definition: LanguageIu.php:70