Skip to content

fix: translations loading #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions classes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function init(): void {
public function register_dashboard_widget(): void {
wp_add_dashboard_widget(
'beapi_posts_lifetime_widget',
__( 'Posts Lifetime Info', 'posts_lifetime' ),
__( 'Posts Lifetime Info', 'posts-lifetime' ),
[ $this, 'render_dashboard_widget' ]
);
}
Expand All @@ -40,11 +40,12 @@ public function render_dashboard_widget(): void {
$retention_period = get_option( 'trash_retention_period', 30 ); // 30 days default if not set
?>
<div>
<h4><?php esc_html_e( 'Expired posts', 'posts_lifetime' ); ?></h4>
<h4><?php esc_html_e( 'Expired posts', 'posts-lifetime' ); ?></h4>
<p>
<?php
/* translators: %d: number of days before permanent deletion */
printf(
esc_html__( 'Here are the last 10 expired posts, to be deleted within %d days after being in trash', 'posts_lifetime' ),
esc_html__( 'Here are the last 10 expired posts, to be deleted within %d days after being in trash', 'posts-lifetime' ),
$retention_period
);
?>
Expand All @@ -69,7 +70,7 @@ public function render_dashboard_widget(): void {
</li>
<?php endforeach; ?>
<?php else : ?>
<li><?php esc_html_e( 'No expired posts.', 'posts_lifetime' ); ?></li>
<li><?php esc_html_e( 'No expired posts.', 'posts-lifetime' ); ?></li>
<?php endif; ?>
</ul>
</div>
Expand All @@ -84,7 +85,7 @@ public function render_dashboard_widget(): void {
public function add_post_lifetime_metabox(): void {
add_meta_box(
'pl_post_lifetime_metabox',
__( 'Post Lifetime', 'posts_lifetime' ),
__( 'Post Lifetime', 'posts-lifetime' ),
[ $this, 'render_post_lifetime_metabox' ],
);
}
Expand All @@ -102,7 +103,7 @@ public function render_post_lifetime_metabox( WP_Post $post ): void {
?>
<p>
<label for="pl_post_lifetime">
<?php _e( 'Define the post expiration date:', 'posts_lifetime' ); ?>
<?php _e( 'Define the post expiration date:', 'posts-lifetime' ); ?>
</label>
</p>
<p>
Expand Down Expand Up @@ -159,7 +160,7 @@ public function trash_retention_period(): void {

add_settings_field(
'trash_retention_period',
__( 'Trash retention period (days) for posts', 'posts_lifetime' ),
__( 'Trash retention period (days) for posts', 'posts-lifetime' ),
function () {
$value = get_option( 'trash_retention_period', 30 );
echo '<input type="number" name="trash_retention_period" value="' . esc_attr( $value ) . '" class="small-text" min="1">';
Expand Down
4 changes: 3 additions & 1 deletion classes/Cron/PostsLifetimeCron.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@ private function trash_expired_posts(): void {

if ( $author_email ) {
// Prepare email content
/* translators: %s: post title */
$subject = sprintf(
__( 'Your post "%s" has been moved to trash', 'posts-lifetime' ),
get_the_title( $post->ID )
);

/* translators: 1: post title, 2: number of days before permanent deletion, 3: post edit link */
$message = sprintf(
__( "Hello,\n\nYour post titled \"%s\" has been automatically moved to trash because its lifetime expired. It will be permanently deleted in %d days.\n\nYou can review and edit your post here: %s\n\nRegards,\nYour Site Team", 'posts_lifetime' ),
__( "Hello,\n\nYour post titled \"%s\" has been automatically moved to trash because its lifetime expired. It will be permanently deleted in %d days.\n\nYou can review and edit your post here: %s\n\nRegards,\nYour Site Team", 'posts-lifetime' ),
get_the_title( $post->ID ),
$retention_period,
esc_url( get_edit_post_link( $post->ID ) )
Expand Down
2 changes: 1 addition & 1 deletion classes/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ protected function init(): void {
*/
public function init_translations(): void {
// Load translations
load_plugin_textdomain( 'posts_lifetime', false, dirname( BEAPI_POSTS_LIFETIME_PLUGIN_BASENAME ) . '/languages' );
load_plugin_textdomain( 'posts-lifetime', false, dirname( BEAPI_POSTS_LIFETIME_PLUGIN_BASENAME ) . '/languages' );
}
}
Binary file removed languages/beapi-posts-lifetime-fr_FR.mo
Binary file not shown.
85 changes: 0 additions & 85 deletions languages/beapi-posts-lifetime-fr_FR.po

This file was deleted.

88 changes: 0 additions & 88 deletions languages/beapi-posts-lifetime.pot

This file was deleted.

Binary file added languages/posts-lifetime-fr_FR.mo
Binary file not shown.
90 changes: 90 additions & 0 deletions languages/posts-lifetime-fr_FR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright (C) 2025 Be API Technical team
# This file is distributed under the same license as the Posts Lifetime plugin.
msgid ""
msgstr ""
"Project-Id-Version: Posts Lifetime 1.0.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/posts-lifetime\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2025-03-24T09:24:19+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.11.0\n"
"X-Domain: posts-lifetime\n"
"Language: fr_FR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: node_modules\n"
"X-Poedit-SearchPathExcluded-1: vendor\n"

#. Plugin Name of the plugin
#: posts-lifetime.php
msgid "Posts Lifetime"
msgstr "Durée de vie des articles"

#. Plugin URI of the plugin
#. Author URI of the plugin
#: posts-lifetime.php
msgid "https://beapi.fr"
msgstr "https://beapi.fr"

#. Description of the plugin
#: posts-lifetime.php
msgid "Define an expiration date for posts."
msgstr "Définir une date d'expiration pour les articles."

#. Author of the plugin
#: posts-lifetime.php
msgid "Be API Technical team"
msgstr "Équipe technique Be API"

#: classes/Admin.php:28
msgid "Posts Lifetime Info"
msgstr "Informations sur la durée de vie des articles"

#: classes/Admin.php:43
msgid "Expired posts"
msgstr "Articles expirés"

#: classes/Admin.php:48
msgid "Here are the last 10 expired posts, to be deleted within %d days after being in trash"
msgstr "Voici les 10 derniers articles expirés, qui seront supprimés dans %d jours après avoir été mis dans la corbeille"

#: classes/Admin.php:73
msgid "No expired posts."
msgstr "Aucun article expiré."

#: classes/Admin.php:88
msgid "Post Lifetime"
msgstr "Durée de vie de l'article"

#: classes/Admin.php:106
msgid "Define the post expiration date:"
msgstr "Définir la date d'expiration de l'article :"

#: classes/Admin.php:163
msgid "Trash retention period (days) for posts"
msgstr "Période de conservation dans la corbeille (jours) pour les articles"

#: classes/Cron/PostsLifetimeCron.php:134
msgid "Your post \"%s\" has been moved to trash"
msgstr "Votre article \"%s\" a été déplacé dans la corbeille"

#. translators: 1: post title, 2: number of days before permanent deletion, 3: post edit link
#: classes/Cron/PostsLifetimeCron.php:140
msgid ""
"Hello,\n"
"\n"
"Your post titled \"%s\" has been automatically moved to trash because its lifetime expired. It will be permanently deleted in %d days.\n"
"\n"
"You can review and edit your post here: %s\n"
"\n"
"Regards,\n"
"Your Site Team"
msgstr "Bonjour,\n\nVotre article intitulé \"%s\" a été automatiquement déplacé dans la corbeille car sa durée de vie a expiré. Il sera supprimé définitivement dans %d jours.\n\nVous pouvez examiner et modifier votre article ici : %s\n\nCordialement,\nL'équipe du site"
Loading