Index: trunk/phase3/maintenance/orphans.php |
— | — | @@ -63,12 +63,12 @@ |
64 | 64 | while( $row = $dbw->fetchObject( $result ) ) { |
65 | 65 | $comment = ( $row->rev_comment == '' ) |
66 | 66 | ? '' |
67 | | - : '(' . $wgContLang->truncate( $row->rev_comment, 40, '...' ) . ')'; |
| 67 | + : '(' . $wgContLang->truncate( $row->rev_comment, 40 ) . ')'; |
68 | 68 | printf( "%10d %10d %14s %20s %s\n", |
69 | 69 | $row->rev_id, |
70 | 70 | $row->rev_page, |
71 | 71 | $row->rev_timestamp, |
72 | | - $wgContLang->truncate( $row->rev_user_text, 17, '...' ), |
| 72 | + $wgContLang->truncate( $row->rev_user_text, 17 ), |
73 | 73 | $comment ); |
74 | 74 | if( $fix ) { |
75 | 75 | $dbw->delete( 'revision', array( 'rev_id' => $row->rev_id ) ); |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -2175,7 +2175,7 @@ |
2176 | 2176 | // Calculate the maximum amount of chars to get |
2177 | 2177 | // Max content length = max comment length - length of the comment (excl. $1) - '...' |
2178 | 2178 | $maxLength = 255 - (strlen( $reason ) - 2) - 3; |
2179 | | - $contents = $wgContLang->truncate( $contents, $maxLength, '...' ); |
| 2179 | + $contents = $wgContLang->truncate( $contents, $maxLength ); |
2180 | 2180 | // Remove possible unfinished links |
2181 | 2181 | $contents = preg_replace( '/\[\[([^\]]*)\]?$/', '$1', $contents ); |
2182 | 2182 | // Now replace the '$1' placeholder |
— | — | @@ -3482,8 +3482,7 @@ |
3483 | 3483 | global $wgContLang; |
3484 | 3484 | $truncatedtext = $wgContLang->truncate( |
3485 | 3485 | str_replace("\n", ' ', $newtext), |
3486 | | - max( 0, 200 - strlen( wfMsgForContent( 'autosumm-new' ) ) ), |
3487 | | - '...' ); |
| 3486 | + max( 0, 200 - strlen( wfMsgForContent( 'autosumm-new' ) ) ) ); |
3488 | 3487 | return wfMsgForContent( 'autosumm-new', $truncatedtext ); |
3489 | 3488 | } |
3490 | 3489 | |
— | — | @@ -3495,9 +3494,7 @@ |
3496 | 3495 | global $wgContLang; |
3497 | 3496 | $truncatedtext = $wgContLang->truncate( |
3498 | 3497 | $newtext, |
3499 | | - max( 0, 200 - strlen( wfMsgForContent( 'autosumm-replace' ) ) ), |
3500 | | - '...' |
3501 | | - ); |
| 3498 | + max( 0, 200 - strlen( wfMsgForContent( 'autosumm-replace' ) ) ) ); |
3502 | 3499 | return wfMsgForContent( 'autosumm-replace', $truncatedtext ); |
3503 | 3500 | } |
3504 | 3501 | |
Index: trunk/phase3/includes/SearchEngine.php |
— | — | @@ -1165,12 +1165,12 @@ |
1166 | 1166 | continue; |
1167 | 1167 | } |
1168 | 1168 | --$contextlines; |
1169 | | - $pre = $wgContLang->truncate( $m[1], -$contextchars, ' ... ' ); |
| 1169 | + $pre = $wgContLang->truncate( $m[1], -$contextchars ); |
1170 | 1170 | |
1171 | 1171 | if ( count( $m ) < 3 ) { |
1172 | 1172 | $post = ''; |
1173 | 1173 | } else { |
1174 | | - $post = $wgContLang->truncate( $m[3], $contextchars, ' ... ' ); |
| 1174 | + $post = $wgContLang->truncate( $m[3], $contextchars ); |
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | $found = $m[2]; |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -554,7 +554,7 @@ |
555 | 555 | $this->textbox2 = $this->safeUnicodeInput( $request, 'wpTextbox2' ); |
556 | 556 | $this->mMetaData = rtrim( $request->getText( 'metadata' ) ); |
557 | 557 | # Truncate for whole multibyte characters. +5 bytes for ellipsis |
558 | | - $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250 ); |
| 558 | + $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250, '' ); |
559 | 559 | |
560 | 560 | # Remove extra headings from summaries and new sections. |
561 | 561 | $this->summary = preg_replace('/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->summary); |
Index: trunk/phase3/includes/specials/SpecialAllpages.php |
— | — | @@ -237,8 +237,8 @@ |
238 | 238 | $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) ); |
239 | 239 | $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) ); |
240 | 240 | // Don't let the length runaway |
241 | | - $inpointf = $wgContLang->truncate( $inpointf, $this->maxPageLength, '...' ); |
242 | | - $outpointf = $wgContLang->truncate( $outpointf, $this->maxPageLength, '...' ); |
| 241 | + $inpointf = $wgContLang->truncate( $inpointf, $this->maxPageLength ); |
| 242 | + $outpointf = $wgContLang->truncate( $outpointf, $this->maxPageLength ); |
243 | 243 | |
244 | 244 | $queryparams = $namespace ? "namespace=$namespace&" : ''; |
245 | 245 | $special = $this->getTitle(); |
Index: trunk/phase3/includes/ImageGallery.php |
— | — | @@ -289,7 +289,7 @@ |
290 | 290 | } |
291 | 291 | |
292 | 292 | $textlink = $this->mShowFilename ? |
293 | | - $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" : |
| 293 | + $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) ) ) . "<br />\n" : |
294 | 294 | '' ; |
295 | 295 | |
296 | 296 | # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -2028,7 +2028,12 @@ |
2029 | 2029 | * @param $ellipsis String to append to the truncated text |
2030 | 2030 | * @return string |
2031 | 2031 | */ |
2032 | | - function truncate( $string, $length, $ellipsis = "" ) { |
| 2032 | + function truncate( $string, $length, $ellipsis = '...' ) { |
| 2033 | + # Use the localized ellipsis character |
| 2034 | + if( $ellipsis == '...' ) { |
| 2035 | + $ellipsis = wfMsgExt( 'ellipsis', array( 'escapenoentities', 'language' => $this ) ); |
| 2036 | + } |
| 2037 | + |
2033 | 2038 | if( $length == 0 ) { |
2034 | 2039 | return $ellipsis; |
2035 | 2040 | } |
— | — | @@ -2045,7 +2050,7 @@ |
2046 | 2051 | } elseif( $char >= 0x80 && |
2047 | 2052 | preg_match( '/^(.*)(?:[\xe0-\xef][\x80-\xbf]|' . |
2048 | 2053 | '[\xf0-\xf7][\x80-\xbf]{1,2})$/', $string, $m ) ) { |
2049 | | - # We chopped in the middle of a character; remove it |
| 2054 | + # We chopped in the middle of a character; remove it |
2050 | 2055 | $string = $m[1]; |
2051 | 2056 | } |
2052 | 2057 | return $string . $ellipsis; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -98,6 +98,8 @@ |
99 | 99 | the active users data from site_stats. |
100 | 100 | * (bug 13040) Gender-aware user namespace aliases |
101 | 101 | * Add a <link rel="canonical"> tag on redirected page views |
| 102 | +* Replace hardcoded '...' as indication of a truncation with the |
| 103 | + 'ellipsis' message |
102 | 104 | |
103 | 105 | === Bug fixes in 1.15 === |
104 | 106 | * (bug 16968) Special:Upload no longer throws useless warnings. |
Index: trunk/extensions/CodeReview/SpecialCode.php |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | $message = trim( $value ); |
143 | 143 | $lines = explode( "\n", $message, 2 ); |
144 | 144 | $first = $lines[0]; |
145 | | - $trimmed = $wgLang->truncate( $first, 80, '...' ); |
| 145 | + $trimmed = $wgLang->truncate( $first, 80 ); |
146 | 146 | return $this->formatMessage( $trimmed ); |
147 | 147 | } |
148 | 148 | /* |
Index: trunk/extensions/CodeReview/CodeRevisionListView.php |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | return intval( $value ); |
153 | 153 | case 'cr_path': |
154 | 154 | return Xml::element('div', array( 'title' => (string)$value ), |
155 | | - $wgLang->truncate( (string)$value, 30, '...' ) ); |
| 155 | + $wgLang->truncate( (string)$value, 30 ) ); |
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
Index: trunk/extensions/CodeReview/CodeCommentsListView.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | return $this->mView->messageFragment( $value ); |
88 | 88 | case 'cc_text': |
89 | 89 | # Truncate this, blah blah... |
90 | | - return htmlspecialchars( $wgLang->truncate( $value, 300, '...' ) ); |
| 90 | + return htmlspecialchars( $wgLang->truncate( $value, 300 ) ); |
91 | 91 | case 'cc_timestamp': |
92 | 92 | global $wgLang; |
93 | 93 | return $wgLang->timeanddate( $value, true ); |
Index: trunk/extensions/MetavidWiki/includes/MV_ImageGallery.php |
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | } |
125 | 125 | |
126 | 126 | $textlink = $this->mShowFilename ? |
127 | | - $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" : |
| 127 | + $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) ) ) . "<br />\n" : |
128 | 128 | '' ; |
129 | 129 | } |
130 | 130 | # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which |
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php |
— | — | @@ -632,12 +632,12 @@ |
633 | 633 | continue; |
634 | 634 | } |
635 | 635 | -- $contextlines; |
636 | | - $pre = $wgContLang->truncate( $m[1], - $contextchars, '...' ); |
| 636 | + $pre = $wgContLang->truncate( $m[1], - $contextchars ); |
637 | 637 | |
638 | 638 | if ( count( $m ) < 3 ) { |
639 | 639 | $post = ''; |
640 | 640 | } else { |
641 | | - $post = $wgContLang->truncate( $m[3], $contextchars, '...' ); |
| 641 | + $post = $wgContLang->truncate( $m[3], $contextchars ); |
642 | 642 | } |
643 | 643 | |
644 | 644 | $found = $m[2]; |
— | — | @@ -651,7 +651,7 @@ |
652 | 652 | } |
653 | 653 | // if we found no matches just return the first line: |
654 | 654 | if ( $extract == '' ) |
655 | | - return ' ' . $wgContLang->truncate( $text, ( $contextchars * 2 ), '...' ) . ''; |
| 655 | + return ' ' . $wgContLang->truncate( $text, ( $contextchars * 2 ) ) . ''; |
656 | 656 | // wfProfileOut( "$fname-extract" ); |
657 | 657 | // wfProfileOut( $fname ); |
658 | 658 | // return "<li>{$link} ({$size}){$extract}</li>\n"; |
Index: trunk/extensions/ImageTagging/ImageTagging_body.php |
— | — | @@ -211,7 +211,7 @@ |
212 | 212 | |
213 | 213 | $nb = ''; |
214 | 214 | $textlink = $this->mShowFilename ? |
215 | | - $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" : |
| 215 | + $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) ) ) . "<br />\n" : |
216 | 216 | ''; |
217 | 217 | |
218 | 218 | $s .= ($i%4==0) ? '<tr>' : ''; |
Index: trunk/extensions/ImageTagging/ImageTagging.php |
— | — | @@ -276,12 +276,12 @@ |
277 | 277 | continue; |
278 | 278 | } |
279 | 279 | $contextlines--; |
280 | | - $pre = $wgContLang->truncate( $m[1], -$contextchars, '...' ); |
| 280 | + $pre = $wgContLang->truncate( $m[1], -$contextchars ); |
281 | 281 | |
282 | 282 | if ( count( $m ) < 3 ) { |
283 | 283 | $post = ''; |
284 | 284 | } else { |
285 | | - $post = $wgContLang->truncate( $m[3], $contextchars, '...' ); |
| 285 | + $post = $wgContLang->truncate( $m[3], $contextchars ); |
286 | 286 | } |
287 | 287 | |
288 | 288 | $found = $m[2]; |
Index: trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php |
— | — | @@ -428,7 +428,7 @@ |
429 | 429 | $plot->format['rave'] = array( 'style' => 'stroke:green; stroke-width:1;' ); |
430 | 430 | $plot->format['dcount'] = array( 'style' => 'stroke:red; stroke-width:1;' ); |
431 | 431 | #'attributes' => "marker-end='url(#circle)'"); |
432 | | - $pageText = $wgContLang->truncate( $this->page->getPrefixedText(), 65, '...' ); |
| 432 | + $pageText = $wgContLang->truncate( $this->page->getPrefixedText(), 65 ); |
433 | 433 | $plot->title = wfMsgExt('ratinghistory-graph',array('parsemag','content'), |
434 | 434 | $totalCount, wfMsgForContent("readerfeedback-$tag"), $pageText ); |
435 | 435 | $plot->styleTitle = 'font-family: sans-serif; font-weight: bold; font-size: 12pt;'; |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php |
— | — | @@ -141,10 +141,10 @@ |
142 | 142 | $formatted = implode( ', ', $flags_display ); |
143 | 143 | break; |
144 | 144 | case 'afh_pattern': |
145 | | - $formatted = htmlspecialchars( $wgLang->truncate( $value, 200, '...' ) ); |
| 145 | + $formatted = htmlspecialchars( $wgLang->truncate( $value, 200 ) ); |
146 | 146 | break; |
147 | 147 | case 'afh_comments': |
148 | | - $formatted = htmlspecialchars( $wgLang->truncate( $value, 200, '...' ) ); |
| 148 | + $formatted = htmlspecialchars( $wgLang->truncate( $value, 200 ) ); |
149 | 149 | break; |
150 | 150 | case 'afh_actions': |
151 | 151 | $actions = unserialize( $value ); |
Index: trunk/extensions/Translate/TranslateUtils.php |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | $message = $m->translation ? $m->translation : $original; |
194 | 194 | |
195 | 195 | global $wgLang; |
196 | | - $niceTitle = htmlspecialchars( $wgLang->truncate( $key, - 30, '…' ) ); |
| 196 | + $niceTitle = htmlspecialchars( $wgLang->truncate( $key, - 30 ) ); |
197 | 197 | |
198 | 198 | if ( 1 || $wgUser->isAllowed( 'translate' ) ) { |
199 | 199 | $tools['edit'] = $sk->makeKnownLinkObj( $title, $niceTitle, "action=edit&loadgroup=$group" ); |
— | — | @@ -368,7 +368,7 @@ |
369 | 369 | global $wgLegalTitleChars, $wgContLang; |
370 | 370 | $snippet = preg_replace( "/[^\p{L}]/u", ' ', $text ); |
371 | 371 | $snippet = preg_replace( "/ {2,}/u", ' ', $snippet ); |
372 | | - $snippet = $wgContLang->truncate( $snippet, $length ); |
| 372 | + $snippet = $wgContLang->truncate( $snippet, $length, '' ); |
373 | 373 | $snippet = str_replace( ' ', '_', trim( $snippet ) ); |
374 | 374 | return $snippet; |
375 | 375 | } |
Index: trunk/extensions/Translate/ffs/Gettext.php |
— | — | @@ -148,7 +148,7 @@ |
149 | 149 | $snippet = preg_replace( "/[^$wgLegalTitleChars]/", ' ', $snippet ); |
150 | 150 | $snippet = preg_replace( "/[:&%\/_]/", ' ', $snippet ); |
151 | 151 | $snippet = preg_replace( "/ {2,}/", ' ', $snippet ); |
152 | | - $snippet = $lang->truncate( $snippet, 30 ); |
| 152 | + $snippet = $lang->truncate( $snippet, 30, '' ); |
153 | 153 | $snippet = str_replace( ' ', '_', trim( $snippet ) ); |
154 | 154 | $key = $this->prefix . $hash . '-' . $snippet; |
155 | 155 | } |
Index: trunk/extensions/catfeed/catfeed.php |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | $text = preg_replace( array_keys($rules), array_values($rules), $text); |
146 | 146 | |
147 | 147 | # only return the first few chars for now |
148 | | - $shorttext = $wgContLang->truncate( trim( $text ), 145, '...' ); |
| 148 | + $shorttext = $wgContLang->truncate( trim( $text ), 145 ); |
149 | 149 | return htmlspecialchars( $shorttext ); |
150 | 150 | } |
151 | 151 | |
Index: trunk/extensions/ReplaceText/SpecialReplaceText.php |
— | — | @@ -169,9 +169,9 @@ |
170 | 170 | $title = Title::makeTitleSafe($row->namespace, $row->title); |
171 | 171 | $article_text = $row->text; |
172 | 172 | $target_pos = strpos($article_text, $target_str); |
173 | | - $context_str = str_replace($angle_brackets, $escaped_angle_brackets, $wgContLang->truncate(substr($article_text, 0, $target_pos), -$contextchars, '...' )); |
| 173 | + $context_str = str_replace($angle_brackets, $escaped_angle_brackets, $wgContLang->truncate(substr($article_text, 0, $target_pos), -$contextchars ) ); |
174 | 174 | $context_str .= "<span class=\"searchmatch\">" . str_replace($angle_brackets, $escaped_angle_brackets, substr($article_text, $target_pos, strlen($target_str))) . "</span>"; |
175 | | - $context_str .= str_replace($angle_brackets, $escaped_angle_brackets, $wgContLang->truncate(substr($article_text, $target_pos + strlen($target_str)), $contextchars, '...' )); |
| 175 | + $context_str .= str_replace($angle_brackets, $escaped_angle_brackets, $wgContLang->truncate(substr($article_text, $target_pos + strlen($target_str)), $contextchars ) ); |
176 | 176 | $found_titles[] = array($title, $context_str); |
177 | 177 | $num_modified_pages++; |
178 | 178 | } |
Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php |
— | — | @@ -941,7 +941,7 @@ |
942 | 942 | htmlspecialchars($row->acr_email) . $econf.'</td></tr>'; |
943 | 943 | # Truncate this, blah blah... |
944 | 944 | $bio = htmlspecialchars($row->acr_bio); |
945 | | - $preview = $wgLang->truncate( $bio, 400 ); |
| 945 | + $preview = $wgLang->truncate( $bio, 400, '' ); |
946 | 946 | if( strlen($preview) < strlen($bio) ) { |
947 | 947 | $preview = substr( $preview, 0, strrpos($preview,' ') ); |
948 | 948 | $preview .= " . . ."; |