r44032 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44031‎ | r44032 | r44033 >
Date:23:54, 28 November 2008
Author:nikerabbit
Status:ok
Tags:
Comment:
* File name (and path) patterns for gettext
Modified paths:
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageGroups.php
@@ -491,6 +491,8 @@
492492 public function getPrefix() { return $this->prefix; }
493493 public function setPrefix( $value ) { $this->prefix = $value; }
494494
 495+ public $filePattern = '%CODE%.po';
 496+
495497 public function getMessageFile( $code ) {
496498 if ( $code == 'en' ) {
497499 return $this->getPotFile();
@@ -498,10 +500,14 @@
499501 if ( isset( $this->codeMap[$code] ) ) {
500502 $code = $this->codeMap[$code];
501503 }
502 - return "$code.po";
 504+ return $this->replaceVariables( $this->filePattern, $code );
503505 }
504506 }
505507
 508+ public function replaceVariables( $string, $code ) {
 509+ return str_replace( '%CODE%', $code, $string );
 510+ }
 511+
506512 public static function factory( $label, $id ) {
507513 $group = new GettextMessageGroup;
508514 $group->setLabel( $label );

Status & tagging log