WorkflowStatesMessageGroup.php
Go to the documentation of this file.00001 <?php
00015 class WorkflowStatesMessageGroup extends WikiMessageGroup {
00016
00017 public function __construct() {
00018 }
00019
00020 public function getId() {
00021 return 'translate-workflow-states';
00022 }
00023
00024 public function getLabel( IContextSource $context = null ) {
00025 $msg = wfMessage( 'translate-workflowgroup-label' );
00026 $msg = self::addContext( $msg, $context );
00027
00028 return $msg->plain();
00029 }
00030
00031 public function getDescription( IContextSource $context = null ) {
00032 $msg = wfMessage( 'translate-workflowgroup-desc' );
00033 $msg = self::addContext( $msg, $context );
00034
00035 return $msg->plain();
00036 }
00037
00038 public function getDefinitions() {
00039 $groups = MessageGroups::getAllGroups();
00040 $keys = array();
00041
00045 foreach ( $groups as $g ) {
00046 $states = $g->getMessageGroupStates()->getStates();
00047 foreach ( array_keys( $states ) as $state ) {
00048 $keys["Translate-workflow-state-$state"] = $state;
00049 }
00050 }
00051
00052 $defs = TranslateUtils::getContents( array_keys( $keys ), $this->getNamespace() );
00053 foreach ( $keys as $key => $state ) {
00054 if ( !isset( $defs[$key] ) ) {
00055
00056 $title = Title::makeTitleSafe( $this->getNamespace(), $key );
00057 $page = new WikiPage( $title );
00058 $page->doEdit(
00059 $state ,
00060 wfMessage( 'translate-workflow-autocreated-summary', $state )->inContentLanguage()->text(),
00061 0,
00062 false,
00063 FuzzyBot::getUser()
00064 );
00065 } else {
00066
00067
00068 list( $content, ) = $defs[$key];
00069 $keys[$key] = $content;
00070 }
00071 }
00072
00073 return $keys;
00074 }
00075 }