- $comment->text = $this->lang->truncate( $comment->text, self::MAX_COMMENT_LENGTH );
- if ( mb_strlen( $comment->text, 'UTF-8' ) > self::COMMENT_CHARACTER_LIMIT ) {
- $ellipsis = wfMessage( 'ellipsis' )->inLanguage( $this->lang )->escaped();
- if ( mb_strlen( $ellipsis ) >= self::COMMENT_CHARACTER_LIMIT ) {
- // WTF?
- $ellipsis = '...';
- }
- $maxLength = self::COMMENT_CHARACTER_LIMIT - mb_strlen( $ellipsis, 'UTF-8' );
- $comment->text = mb_substr( $comment->text, 0, $maxLength, 'UTF-8' ) . $ellipsis;
- }