Skip to content

Commit

Permalink
Translation-friendlier adjustments
Browse files Browse the repository at this point in the history
Thanks to @kebbet for pointing this out.
  • Loading branch information
soup-bowl committed Apr 3, 2024
1 parent 2faf01e commit a082b98
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions src/settings/class-singular.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,17 @@ private function render_settings() {
$page = intval( wp_unslash( $_REQUEST['wpss_page'] ) );
}

$log_limit = apply_filters( 'simple_smtp_log_expiry', 2629800 );
$log_disabled = apply_filters( 'simple_smtp_disable_log_prune', false );
$log_limit = apply_filters( 'simple_smtp_log_expiry', 2629800 );
$log_disabled = apply_filters( 'simple_smtp_disable_log_prune', false );
$expiry_string = sprintf(
/* translators: %s: time amount or never. */
__( 'Log entries are deleted after: %s', 'simple-smtp' ),
( ( ! $log_disabled ) ? $this->seconds_to_duration( $log_limit ) : __( 'never', 'simple-smtp' ) )
);

echo wp_kses(
'<h2 id="log">' . __( 'Email Log', 'simple-smtp' ) . '</h2>
<p>Log expiry: ' . ( ( ! $log_disabled ) ? $this->seconds_to_duration( $log_limit ) : 'never' ) . '</p>',
<p>' . $expiry_string . '</p>',
[
'h2' => [ 'id' => [] ],
'p' => [],
Expand Down Expand Up @@ -329,17 +335,28 @@ private function seconds_to_duration( $seconds ) {
$year = 12 * $month;

if ( $seconds < $minute ) {
return $seconds . ' ' . __( 'seconds', 'simple-smtp' );
/* translators: %s: time to deletion in seconds. */

This comment has been minimized.

Copy link
@soup-bowl

soup-bowl Apr 3, 2024

Author Owner

These were mandated by the WPCS - @kebbet are these descriptions sufficient for translations?

This comment has been minimized.

Copy link
@kebbet

kebbet Apr 3, 2024

Contributor

Yeah, those are handy while translating, descriptions looks ok to me!

return sprintf( _n( '%s second', '%s seconds', $seconds, 'simple-smtp' ), $seconds );
} elseif ( $seconds < $hour ) {
return round( $seconds / $minute ) . ' ' . __( 'minute(s)', 'simple-smtp' );
$minutes = round( $seconds / $minute );
/* translators: %s: time to deletion in minutes. */
return sprintf( _n( '%s minute', '%s minutes', $minutes, 'simple-smtp' ), $minutes );
} elseif ( $seconds < $day ) {
return round( $seconds / $hour ) . ' ' . __( 'hour(s)', 'simple-smtp' );
$hours = round( $seconds / $hour );
/* translators: %s: time to deletion in hours. */
return sprintf( _n( '%s hour', '%s hours', $hours, 'simple-smtp' ), $hours );
} elseif ( $seconds < $month ) {
return round( $seconds / $day ) . ' ' . __( 'day(s)', 'simple-smtp' );
$days = round( $seconds / $day );
/* translators: %s: time to deletion in days. */
return sprintf( _n( '%s day', '%s days', $days, 'simple-smtp' ), $days );
} elseif ( $seconds < $year ) {
return round( $seconds / $month ) . ' ' . __( 'month(s)', 'simple-smtp' );
$months = round( $seconds / $month );
/* translators: %s: time to deletion in months. */
return sprintf( _n( '%s month', '%s months', $months, 'simple-smtp' ), $months );
} else {
return round( $seconds / $year ) . ' ' . __( 'year(s)', 'simple-smtp' );
$years = round( $seconds / $year );
/* translators: %s: time to deletion in years. */
return sprintf( _n( '%s year', '%s years', $years, 'simple-smtp' ), $years );
}
}
}

0 comments on commit a082b98

Please sign in to comment.