/**
* Create a language object for a given language code
* @param $code String
+ * @throws MWException
* @return Language
*/
protected static function newFromCode( $code ) {
if ( $usemsg && wfMessage( $msg )->exists() ) {
return $this->getMessageFromDB( $msg );
}
- $name = self::getLanguageName( $code );
+ $name = self::fetchLanguageName( $code );
if ( $name ) {
return $name; # if it's defined as a language name, show that
} else {
* @param $file string
* @param $string string
*
+ * @throws MWException
* @return string
*/
function transformUsingPairFile( $file, $string ) {
* @param $prefix string Prepend this to the filename
* @param $code string Language code
* @param $suffix string Append this to the filename
+ * @throws MWException
* @return string $prefix . $mangledCode . $suffix
*/
public static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) {
$this->mMainLanguageCode = $maincode;
$this->mVariants = array_diff( $variants, $wgDisabledVariants );
$this->mVariantFallbacks = $variantfallbacks;
- $this->mVariantNames = Language::getLanguageNames();
+ $this->mVariantNames = Language::fetchLanguageNames();
$this->mCacheKey = wfMemcKey( 'conversiontables', $maincode );
$defaultflags = array(
// 'S' show converted text
* @param $startPos int
* @param $depth Integer: depth of recursion
*
+ * @throws MWException
* @return String: converted text
*/
protected function recursiveConvertRule( $text, $variant, &$startPos, $depth = 0 ) {
* This method must be implemented in derived class.
*
* @private
+ * @throws MWException
*/
function loadDefaultTables() {
$name = get_class( $this );
* @param $text string
* @param $toVariant bool
*
+ * @throws MWException
* @return string
*/
function translate( $text, $toVariant ) {
if ( !count( $forms ) ) { return ''; }
$forms = $this->preConvertPlural( $forms, 3 );
$count = abs( $count );
- if ( $count == 1 )
- return $forms[0]; // singular
+ if ( $count == 1 ) {
+ return $forms[0]; // singular
+ }
switch ( $count % 10 ) {
case 2:
case 3:
case 4:
- if ( $count / 10 % 10 != 1 )
+ if ( $count / 10 % 10 != 1 ) {
return $forms[1]; // plural
+ }
default:
return $forms[2]; // plural genitive
}
* @param $text string
* @param $toVariant string
*
+ * @throws MWException
* @return string
*/
function translate( $text, $toVariant ) {