better actual translation support
This commit is contained in:
parent
af6dd43241
commit
c9c155a858
1 changed files with 14 additions and 12 deletions
|
@ -41,17 +41,17 @@ class Comments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the comment text to display webfinger in the Recently Published Dashboard Widget.
|
* Filters the comment text to display webfinger in the Recently Published Dashboard Widget.
|
||||||
* comment_excerpt( $comment_excerpt, $comment_ID )
|
* comment_excerpt( $comment_excerpt, $comment_id )
|
||||||
*
|
*
|
||||||
* doesn't work on received webfinger links as get_comment_excerpt strips tags
|
* doesn't work on received webfinger links as get_comment_excerpt strips tags
|
||||||
* https://developer.wordpress.org/reference/functions/get_comment_excerpt/
|
* https://developer.wordpress.org/reference/functions/get_comment_excerpt/
|
||||||
* @param string $comment_text
|
* @param string $comment_text
|
||||||
* @param int $comment_ID
|
* @param int $comment_id
|
||||||
* @param array $args
|
* @param array $args
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function comment_excerpt( $comment_excerpt, $comment_ID ) {
|
public static function comment_excerpt( $comment_excerpt, $comment_id ) {
|
||||||
$comment = get_comment( $comment_ID );
|
$comment = get_comment( $comment_id );
|
||||||
$comment_excerpt = \apply_filters( 'the_content', $comment_excerpt, $comment );
|
$comment_excerpt = \apply_filters( 'the_content', $comment_excerpt, $comment );
|
||||||
return $comment_excerpt;
|
return $comment_excerpt;
|
||||||
}
|
}
|
||||||
|
@ -70,15 +70,17 @@ class Comments {
|
||||||
$protocol = \get_comment_meta( $comment->comment_ID, 'protocol', true );
|
$protocol = \get_comment_meta( $comment->comment_ID, 'protocol', true );
|
||||||
// TODO Test if this is returned by Model/Comment
|
// TODO Test if this is returned by Model/Comment
|
||||||
if ( 'activitypub' === $protocol ) {
|
if ( 'activitypub' === $protocol ) {
|
||||||
$updated = \strtotime( \get_comment_meta( $comment->comment_ID, 'ap_last_modified', true ) );
|
$updated = \get_comment_meta( $comment->comment_ID, 'ap_last_modified', true );
|
||||||
if ( $updated ) {
|
if ( $updated ) {
|
||||||
$comment_text .= '<small>' . wp_sprintf(
|
$format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
|
||||||
_x( '(Last edited %1$s ago)', '%2$s = human-readable time difference', 'activitypub' ),
|
$formatted_datetime = \date_i18n( $format, \strtotime( $updated ) );
|
||||||
human_time_diff(
|
$iso_date = \wp_date( 'c', \strtotime( $updated ) );
|
||||||
$updated,
|
$i18n_text = sprintf(
|
||||||
current_time( 'timestamp' )
|
/* translators: %s: Displays comment last modified date and time */
|
||||||
)
|
__( '(Last edited on %s)', 'activitypub' ),
|
||||||
) . '</small>';
|
"<time class='modified' datetime='{$iso_date}'>$formatted_datetime</time>"
|
||||||
|
);
|
||||||
|
$comment_text .= "<small>$i18n_text<small>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $comment_text;
|
return $comment_text;
|
||||||
|
|
Loading…
Reference in a new issue