Index: branches/wmf/1.18wmf1/extensions/Translate/check-blacklist.php |
— | — | @@ -651,7 +651,7 @@ |
652 | 652 | ), |
653 | 653 | // translatewiki.net specific |
654 | 654 | array( |
655 | | - 'group' => 'page|Translating:Intro', |
| 655 | + 'group' => 'page-Translating:Intro', |
656 | 656 | 'check' => 'links', |
657 | 657 | 'message' => array( |
658 | 658 | 'Translating:Intro/intro', // Contains links that are translated |
Index: branches/wmf/1.18wmf1/extensions/Translate/MessageGroups.php |
— | — | @@ -1184,6 +1184,8 @@ |
1185 | 1185 | * @return MessageGroup|null if it doesn't exist. |
1186 | 1186 | */ |
1187 | 1187 | public static function getGroup( $id ) { |
| 1188 | + // BC with page| which is now page- |
| 1189 | + $id = strtr( $id, '|', '-' ); |
1188 | 1190 | self::init(); |
1189 | 1191 | |
1190 | 1192 | global $wgTranslateEC, $wgTranslateAC, $wgTranslateCC; |
Index: branches/wmf/1.18wmf1/extensions/Translate/tag/TranslatablePage.php |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | * @return \string |
183 | 183 | */ |
184 | 184 | public static function getMessageGroupIdFromTitle( Title $title ) { |
185 | | - return 'page|' . $title->getPrefixedText(); |
| 185 | + return 'page-' . $title->getPrefixedText(); |
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
Index: branches/wmf/1.18wmf1/extensions/Translate/tag/SpecialPageTranslation.php |
— | — | @@ -122,7 +122,9 @@ |
123 | 123 | |
124 | 124 | if ( $revision !== intval( $title->getLatestRevID() ) ) { |
125 | 125 | // We do want to notify the reviewer if the underlying page changes during review |
126 | | - $wgOut->addWikiMsg( 'tpt-oldrevision', $title->getPrefixedText(), $revision ); |
| 126 | + $target = $title->getFullUrl( array( 'oldid' => $revision ) ); |
| 127 | + $link = "<span class='plainlinks'>[$target $revision]</span>"; |
| 128 | + $wgOut->addWikiMsg( 'tpt-oldrevision', $title->getPrefixedText(), $link ); |
127 | 129 | self::superDebug( __METHOD__, "revision mismatch while marking", $this->user, $title, $revision, intval( $title->getLatestRevID() ) ); |
128 | 130 | return; |
129 | 131 | } |
— | — | @@ -390,6 +392,8 @@ |
391 | 393 | public function checkInput( TranslatablePage $page, &$error = false ) { |
392 | 394 | global $wgOut, $wgRequest; |
393 | 395 | |
| 396 | + $usedNames = array(); |
| 397 | + |
394 | 398 | $parse = $page->getParse(); |
395 | 399 | $sections = $parse->getSectionsForSave(); |
396 | 400 | foreach ( $sections as $s ) { |
— | — | @@ -397,12 +401,20 @@ |
398 | 402 | // to link the new names to current sections. Name will become |
399 | 403 | // the new id only after it is saved into db and the page. |
400 | 404 | // Do not allow changing names for old sections |
401 | | - $s->name = $s->id; |
402 | | - if ( $s->type !== 'new' ) { |
403 | | - continue; |
| 405 | + if ( $s->type === 'new' ) { |
| 406 | + $name = $wgRequest->getText( 'tpt-sect-' . $s->id, $s->id ); |
| 407 | + } else { |
| 408 | + $name = $s->id; |
404 | 409 | } |
405 | 410 | |
406 | | - $name = $wgRequest->getText( 'tpt-sect-' . $s->id, $s->id ); |
| 411 | + // We need to do checks for both new and existing sections. |
| 412 | + // Someone might have tampered with the page source adding |
| 413 | + // duplicate or invalid markers. |
| 414 | + if ( isset( $usedNames[$name] ) ) { |
| 415 | + $wgOut->addWikiMsg( 'tpt-duplicate', $name ); |
| 416 | + $error = true; |
| 417 | + } |
| 418 | + $usedNames[$name] = true; |
407 | 419 | |
408 | 420 | // Make sure valid title can be constructed |
409 | 421 | $sectionTitle = Title::makeTitleSafe( |
Index: branches/wmf/1.18wmf1/extensions/Translate/tag/TPParse.php |
— | — | @@ -76,13 +76,11 @@ |
77 | 77 | $sections = $this->sections; |
78 | 78 | $highest = 0; |
79 | 79 | foreach ( array_keys( $this->dbSections ) as $key ) { |
80 | | - if ( !is_int( $key ) ) continue; |
81 | | - $highest = max( $highest, $key ); |
| 80 | + $highest = max( $highest, intval( $key ) ); |
82 | 81 | } |
83 | 82 | |
84 | 83 | foreach ( $sections as $_ ) { |
85 | | - if ( !is_int( $_->id ) ) continue; |
86 | | - $highest = max( $_->id, $highest ); |
| 84 | + $highest = max( $highest, intval( $_->id ) ); |
87 | 85 | } |
88 | 86 | |
89 | 87 | foreach ( $sections as $s ) { |
Index: branches/wmf/1.18wmf1/extensions/Translate/README |
— | — | @@ -29,6 +29,9 @@ |
30 | 30 | http://translatewiki.net/docs/Translate/html/ |
31 | 31 | |
32 | 32 | == Change log == |
| 33 | +* 2012-01-11 |
| 34 | +- Translate page group id prefix was changed from page| to page-. Some old |
| 35 | + links need to be updated, some still work. |
33 | 36 | * 2012-01-10 |
34 | 37 | - Translate extension no longer unconditionally suppresses edit intros |
35 | 38 | - Fixed compatibility issue with logs on < MW 1.18 |
Index: branches/wmf/1.18wmf1/extensions/Translate/PageTranslation.i18n.php |
— | — | @@ -46,6 +46,7 @@ |
47 | 47 | Before marking this version for translation, check that the changes to sections are minimised to avoid unnecessary work for translators.', |
48 | 48 | 'tpt-mark-summary' => 'Marked this version for translation', |
49 | 49 | 'tpt-edit-failed' => 'Could not update the page: $1', |
| 50 | + 'tpt-duplicate' => 'Translation unit name $1 is used more than once.', |
50 | 51 | 'tpt-already-marked' => 'The latest version of this page has already been marked for translation.', |
51 | 52 | 'tpt-unmarked' => 'Page $1 is no longer marked for translation.', |
52 | 53 | |
Index: branches/wmf/1.18wmf1/extensions/Translate/utils/TranslationEditPage.php |
— | — | @@ -111,8 +111,8 @@ |
112 | 112 | $hidden[] = Html::hidden( 'format', 'json' ); |
113 | 113 | $hidden[] = Html::hidden( 'action', 'edit' ); |
114 | 114 | |
115 | | - $summary = Xml::inputLabel( wfMsg( 'summary' ), 'summary', 'summary', 40 ); |
116 | | - $save = Xml::submitButton( wfMsg( 'savearticle' ), array( 'class' => 'mw-translate-save' ) ); |
| 115 | + $summary = Xml::inputLabel( wfMsg( 'translate-js-summary' ), 'summary', 'summary', 40 ); |
| 116 | + $save = Xml::submitButton( wfMsg( 'translate-js-save' ), array( 'class' => 'mw-translate-save' ) ); |
117 | 117 | $saveAndNext = Xml::submitButton( wfMsg( 'translate-js-next' ), array( 'class' => 'mw-translate-next' ) ); |
118 | 118 | $skip = Html::element( 'input', array( 'class' => 'mw-translate-skip', 'type' => 'button', 'value' => wfMsg( 'translate-js-skip' ) ) ); |
119 | 119 | |
Index: branches/wmf/1.18wmf1/extensions/Translate/utils/TranslationHelpers.php |
— | — | @@ -864,7 +864,7 @@ |
865 | 865 | $title = $this->handle->getTitle(); |
866 | 866 | $key = $this->handle->getKey(); |
867 | 867 | |
868 | | - if ( $group instanceof WikiPageMessageGroup ) { |
| 868 | + if ( $group instanceof WikiPageMessageGroup || !$title->exists() ) { |
869 | 869 | return null; |
870 | 870 | } |
871 | 871 | |
Index: branches/wmf/1.18wmf1/extensions/Translate/Translate.i18n.php |
— | — | @@ -344,6 +344,8 @@ |
345 | 345 | Make sure your editor does not remove msgctxt fields. |
346 | 346 | Details: $1', |
347 | 347 | |
| 348 | + 'translate-js-summary' => 'Summary:', |
| 349 | + 'translate-js-save' => 'Save', |
348 | 350 | 'translate-js-next' => 'Save and open next', |
349 | 351 | 'translate-js-nonext' => 'This was the last message on this page.', |
350 | 352 | 'translate-js-skip' => 'Skip to next', |
— | — | @@ -627,6 +629,8 @@ |
628 | 630 | 'translate-import-err-no-such-file' => 'Used in [[Special:ImportTranslations]].', |
629 | 631 | 'translate-import-err-no-headers' => 'Used in [[Special:ImportTranslations]].', |
630 | 632 | 'translate-import-err-warnings' => 'Used in [[Special:ImportTranslations]].', |
| 633 | + 'translate-js-summary' => 'Label for summary field in translation editor', |
| 634 | + 'translate-js-save' => 'Button in translation editor which saves the content and closes the dialog', |
631 | 635 | 'translate-js-next' => 'next refers to next message in the message list', |
632 | 636 | 'translate-js-nonext' => 'This is a JavaScript popup (alert) when user clicks "Save and open next" and there is no next message.', |
633 | 637 | 'translate-js-skip' => 'A button together with Save and Save an open next. Goes to the next message without saving.', |
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialTranslationStats.php |
— | — | @@ -78,7 +78,8 @@ |
79 | 79 | $values = array_map( 'trim', explode( ',', $opts[$t] ) ); |
80 | 80 | $values = array_splice( $values, 0, 4 ); |
81 | 81 | if ( $t === 'group' ) { |
82 | | - $values = preg_replace( '~^page_~', 'page|', $values ); |
| 82 | + // BC for old syntax which replaced _ to | which was not allowed |
| 83 | + $values = preg_replace( '~^page_~', 'page-', $values ); |
83 | 84 | } |
84 | 85 | $opts[$t] = implode( ',', $values ); |
85 | 86 | } |
Index: branches/wmf/1.18wmf1/extensions/Translate/api/ApiGroupReview.php |
— | — | @@ -97,11 +97,7 @@ |
98 | 98 | global $wgTranslateWorkflowStates; |
99 | 99 | return array( |
100 | 100 | 'group' => array( |
101 | | - /* API borks with | if defined multiple allowed values even |
102 | | - * though we are expecting only one value, which can and will |
103 | | - * contain | for page translation pages, which have group id |
104 | | - * of format page|Pagename. This is fixed in 1.19 and up */ |
105 | | - ApiBase::PARAM_TYPE => 'string',//array_keys( MessageGroups::getAllGroups() ), |
| 101 | + ApiBase::PARAM_TYPE => array_keys( MessageGroups::getAllGroups() ), |
106 | 102 | ApiBase::PARAM_REQUIRED => true, |
107 | 103 | ), |
108 | 104 | 'language' => array( |