r41430 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41429‎ | r41430 | r41431 >
Date:16:24, 30 September 2008
Author:demon
Status:old (Comments)
Tags:
Comment:
* Add $forContent option to Language::commaList
* Add pipeList() for similar lists separated by pipes
* More docs.
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messageTypes.inc (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -2566,6 +2566,7 @@
25672567 'comma-separator',
25682568 'colon-separator',
25692569 'autocomment-prefix',
 2570+ 'pipe-separator',
25702571 ),
25712572 'imgmulti' => array(
25722573 'imgmultipageprev',
Index: trunk/phase3/maintenance/language/messageTypes.inc
@@ -315,6 +315,7 @@
316316 'comma-separator',
317317 'colon-separator',
318318 'autocomment-prefix',
 319+ 'pipe-separator',
319320 'listgrouprights-right-display',
320321 'timezone-utc',
321322 'whatlinkshere-backlink',
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3437,6 +3437,7 @@
34383438 'comma-separator' => ', ', # only translate this message to other languages if you have to change it
34393439 'colon-separator' => ': ', # only translate this message to other languages if you have to change it
34403440 'autocomment-prefix' => '- ', # only translate this message to other languages if you have to change it
 3441+'pipe-separator' => '|', # only translate this message to other languages if you have to change it
34413442
34423443 # Multipage image navigation
34433444 'imgmultipageprev' => '← previous page',
Index: trunk/phase3/languages/Language.php
@@ -1902,13 +1902,35 @@
19031903 /**
19041904 * Take a list of strings and build a locale-friendly comma-separated
19051905 * list, using the local comma-separator message.
1906 - * @fixme Fix this so it can work for $wgContLang too
 1906+ * @param $list array of strings to put in a comma list
 1907+ * @param $forContent bool Use $wgContentLang instead of the UI lang
 1908+ * @return string
19071909 */
1908 - function commaList( $list ) {
 1910+ function commaList( $list, $forContent = false ) {
 1911+ $params = array( 'escapenoentities' );
 1912+ if ( $forContent === true ) {
 1913+ $params[] = 'content';
 1914+ }
19091915 return implode(
19101916 $list,
1911 - wfMsgExt( 'comma-separator', 'escapenoentities' ) );
 1917+ wfMsgExt( 'comma-separator', $params ) );
19121918 }
 1919+
 1920+ /**
 1921+ * Same as commaList, but separate it with the pipe instead.
 1922+ * @param $list array of strings to put in a pipe list
 1923+ * @param $forContent bool Use $wgContentLang instead of the UI lang
 1924+ * @return string
 1925+ */
 1926+ function pipeList( $list, $forContent = false ) {
 1927+ $params = array( 'escapenoentities' );
 1928+ if ( $forContent === true ) {
 1929+ $params[] = 'content';
 1930+ }
 1931+ return implode(
 1932+ $list,
 1933+ wfMsgExt( 'pipe-separator', $params ) );
 1934+ }
19131935
19141936 /**
19151937 * Truncate a string to a specified length in bytes, appending an optional

Follow-up revisions

RevisionCommit summaryAuthorDate
r41431Fix for r41430: wfMsgExt() now accepts a Language object in the language key ...ialex17:15, 30 September 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   20:21, 30 September 2008

forContent is a bit of an ugly hack here... r41431 redoes it correctly. :)

Status & tagging log