}
/**
- * Ugly hack to get a message maybe from the MediaWiki namespace, if this
- * language object is the content or user language.
+ * Get a message from the MediaWiki namespace.
+ *
+ * @param $msg String: message name
+ * @return string
*/
function getMessageFromDB( $msg ) {
- global $wgContLang, $wgLang;
- if ( $wgContLang->getCode() == $this->getCode() ) {
- # Content language
- return wfMsgForContent( $msg );
- } elseif ( $wgLang->getCode() == $this->getCode() ) {
- # User language
- return wfMsg( $msg );
- } else {
- # Neither, get from localisation
- return $this->getMessage( $msg );
- }
+ return wfMsgExt( $msg, array( 'parsemag', 'language' => $this ) );
}
function getLanguageName( $code ) {
* </code>
*
* See LanguageGu.php for the Gujarati implementation and
- * LanguageIs.php for the , => . and . => , implementation.
+ * $separatorTransformTable on MessageIs.php for
+ * the , => . and . => , implementation.
*
* @todo check if it's viable to use localeconv() for the decimal
- * seperator thing.
+ * separator thing.
* @param $number Mixed: the string to be formatted, should be an integer
* or a floating point number.
* @param $nocommafy Bool: set to true for special numbers like dates
}
return $s;
}
+
+ /**
+ * Take a list of strings and build a locale-friendly comma-separated
+ * list, using the local comma-separator message.
+ * @param $list array of strings to put in a comma list
+ * @return string
+ */
+ function commaList( $list, $forContent = false ) {
+ return implode(
+ $list,
+ wfMsgExt( 'comma-separator', array( 'escapenoentities', 'language' => $this ) ) );
+ }
+
+ /**
+ * Same as commaList, but separate it with the pipe instead.
+ * @param $list array of strings to put in a pipe list
+ * @return string
+ */
+ function pipeList( $list ) {
+ return implode(
+ $list,
+ wfMsgExt( 'pipe-separator', array( 'escapenoentities', 'language' => $this ) ) );
+ }
/**
* Truncate a string to a specified length in bytes, appending an optional
if ( !count($forms) ) { return ''; }
$forms = $this->preConvertPlural( $forms, 2 );
- return ( abs($count) == 1 ) ? $forms[0] : $forms[1];
+ return ( $count == 1 ) ? $forms[0] : $forms[1];
}
/**