[PATCH] fixing translations
-
Hi,
please find my patch attached, which makes all
__(),_x(),_n_noop(), and_e()translatable by replacing some wrongfully placedself::return_plugin_namespace()withself::return_plugin_text_domain().Please also consider to check out the translations waiting for approval at https://translate.ww.wp.xz.cn/projects/wp-plugins/lh-archived-post-status/dev/de/default/.
Index: lh-archived-post-status.php
===================================================================
--- lh-archived-post-status.php (revision 3236713)
+++ lh-archived-post-status.php (working copy)
@@ -339,7 +339,7 @@ class LH_archived_post_status_plugin {
if (empty($date)){
- _e( 'Never', self::return_plugin_namespace());
+ _e( 'Never', self::return_plugin_text_domain());
} else {
@@ -432,8 +432,8 @@ class LH_archived_post_status_plugin {
}
?><select name="<?php echo self::return_opt_name().'['.$args[0].']'; ?>" id="<?php echo self::return_publicly_available(); ?>"><?php
- ?><option value="1" <?php if ($selected == 1){ echo 'selected="selected"'; } ?>><?php _e('Yes - But not in the, main loop, frontpage, or feed', self::return_plugin_namespace()); ?></option><?php
- ?><option value="0" <?php if ($selected == 0){ echo 'selected="selected"'; } ?>><?php _e('No - only logged in users can view archived posts', self::return_plugin_namespace()); ?></option><?php
+ ?><option value="1" <?php if ($selected == 1){ echo 'selected="selected"'; } ?>><?php _e('Yes - But not in the, main loop, frontpage, or feed', self::return_plugin_text_domain()); ?></option><?php
+ ?><option value="0" <?php if ($selected == 0){ echo 'selected="selected"'; } ?>><?php _e('No - only logged in users can view archived posts', self::return_plugin_text_domain()); ?></option><?php
echo '</select>'."\n";
}
@@ -452,7 +452,7 @@ class LH_archived_post_status_plugin {
}
- echo '<input type="text" name="'.self::return_opt_name().'['.$args[0].']" id="'.$args[0].'" value="'.$value.'" size="20" /><br/>'.__('This label will appear after the title for archived posts on the front end of your website', self::return_plugin_namespace())."\n";
+ echo '<input type="text" name="'.self::return_opt_name().'['.$args[0].']" id="'.$args[0].'" value="'.$value.'" size="20" /><br/>'.__('This label will appear after the title for archived posts on the front end of your website', self::return_plugin_text_domain())."\n";
}
@@ -498,7 +498,7 @@ class LH_archived_post_status_plugin {
add_settings_field( // Option 1
self::return_publicly_available(), // Option ID
- __('Can Archived Posts be read publicly:', self::return_plugin_namespace()), // Label
+ __('Can Archived Posts be read publicly:', self::return_plugin_text_domain()), // Label
array($this, 'render_publicly_dropdown'), // !important - This is where the args go!
'reading', // Page it will be displayed (General Settings)
self::return_opt_name(), // Name of our section
@@ -511,7 +511,7 @@ class LH_archived_post_status_plugin {
add_settings_field( // Option 2
self::return_title_label_field_name(), // Option ID
- __('Title Label:', self::return_plugin_namespace()), // Label
+ __('Title Label:', self::return_plugin_text_domain()), // Label
array($this, 'render_title_label_input'), // !important - This is where the args go!
'reading', // Page it will be displayed (General Settings)
self::return_opt_name(), // Name of our section
@@ -522,7 +522,7 @@ class LH_archived_post_status_plugin {
add_settings_field( // Option 3
self::return_message_field_name(), // Option ID
- __('Archive Message:', self::return_plugin_namespace()), // Label
+ __('Archive Message:', self::return_plugin_text_domain()), // Label
array($this, 'render_message_editor'), // !important - This is where the args go!
'reading', // Page it will be displayed (General Settings)
self::return_opt_name(), // Name of our section
@@ -536,7 +536,7 @@ class LH_archived_post_status_plugin {
add_settings_section(
self::return_opt_name(), // Section ID
- __('Archiving Settings', self::return_plugin_namespace()), // Section Title
+ __('Archiving Settings', self::return_plugin_text_domain()), // Section Title
array($this, 'reading_setting_callback'), // Callback
'reading' // What Page? This makes the section show up on the General Settings Page
);
@@ -630,7 +630,7 @@ class LH_archived_post_status_plugin {
if ( current_user_can('publish_posts') ) {
- $actions['archive_link'] = '<a href="'.self::get_archive_post_link($post->ID).'" title="' . esc_attr( __( 'Archive this post' , self::return_plugin_namespace()) ) . '">' . __( 'Archive', self::return_plugin_namespace() ) . '</a>';
+ $actions['archive_link'] = '<a href="'.self::get_archive_post_link($post->ID).'" title="' . esc_attr( __( 'Archive this post' , self::return_plugin_text_domain()) ) . '">' . __( 'Archive', self::return_plugin_text_domain() ) . '</a>';
}
@@ -658,7 +658,7 @@ class LH_archived_post_status_plugin {
if (!get_post_status($post_id)){
- echo __('invalid post id', self::return_plugin_namespace());
+ echo __('invalid post id', self::return_plugin_text_domain());
exit;
}
@@ -666,7 +666,7 @@ class LH_archived_post_status_plugin {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
- echo __('Current user does not have capability', self::return_plugin_namespace());
+ echo __('Current user does not have capability', self::return_plugin_text_domain());
exit;
@@ -782,7 +782,7 @@ class LH_archived_post_status_plugin {
if (!get_option(self::return_opt_name())){
$options[ self::return_publicly_available() ] = true;
- $options[ self::return_message_field_name() ] = '<p>'.__('This content has been archived. It may no longer be relevant', self::return_plugin_namespace()).'</p>';
+ $options[ self::return_message_field_name() ] = '<p>'.__('This content has been archived. It may no longer be relevant', self::return_plugin_text_domain()).'</p>';
update_option( self::return_opt_name(), $options );
@@ -905,7 +905,7 @@ class LH_archived_post_status_plugin {
if ($url = self::get_archive_post_link( $post_object->ID )){
- $string .= "\n".'<li><a rel="nofollow" href="'.$url.'">'.__('Archive', self::return_plugin_namespace()).'</a></li>';
+ $string .= "\n".'<li><a rel="nofollow" href="'.$url.'">'.__('Archive', self::return_plugin_text_domain()).'</a></li>';
}
@@ -928,9 +928,9 @@ class LH_archived_post_status_plugin {
}
$args = array(
- 'label' => _x( ucwords(self::return_new_status_label()), 'post status label', self::return_plugin_namespace() ),
+ 'label' => _x( ucwords(self::return_new_status_label()), 'post status label', self::return_plugin_text_domain() ),
'public' => $public,
- 'label_count' => _n_noop( self::return_new_status_count(), self::return_new_status_count(), self::return_plugin_namespace() ),
+ 'label_count' => _n_noop( self::return_new_status_count(), self::return_new_status_count(), self::return_plugin_text_domain() ),
'post_type' => self::get_applicable_post_types(), // Define one or more post types the status can be applied to.
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
@@ -939,17 +939,17 @@ class LH_archived_post_status_plugin {
'publicly_queryable' => true,
'dashicon' => 'dashicons-archive',
'labels' => array(
- 'metabox_dropdown' => __( 'Archived', self::return_plugin_namespace() ),
- 'metabox_submit' => __( 'Archive', self::return_plugin_namespace()),
- 'metabox_save_on' => __( 'Archive on:', self::return_plugin_namespace() ),
+ 'metabox_dropdown' => __( 'Archived', self::return_plugin_text_domain() ),
+ 'metabox_submit' => __( 'Archive', self::return_plugin_text_domain()),
+ 'metabox_save_on' => __( 'Archive on:', self::return_plugin_text_domain() ),
/* translators: Post date information. 1: Date on which the post is to be archived */
- 'metabox_save_date' => __( 'Archive on: <b>%1$s</b>', self::return_plugin_namespace() ),
- 'metabox_saved_on' => __( 'Archived on:', self::return_plugin_namespace() ),
+ 'metabox_save_date' => __( 'Archive on: <b>%1$s</b>', self::return_plugin_text_domain() ),
+ 'metabox_saved_on' => __( 'Archived on:', self::return_plugin_text_domain() ),
/* translators: Post date information. 1: Date on which the post was archived */
- 'metabox_saved_date' => __( 'Archived on: <b>%1$s</b>', self::return_plugin_namespace()),
- 'metabox_save_now' => __( 'Archive <b>now</b>', self::return_plugin_namespace() ),
- 'inline_dropdown' => __( 'Archived', self::return_plugin_namespace() ),
- 'press_this_dropdown' => __( 'Add to archives', self::return_plugin_namespace() ),
+ 'metabox_saved_date' => __( 'Archived on: <b>%1$s</b>', self::return_plugin_text_domain()),
+ 'metabox_save_now' => __( 'Archive <b>now</b>', self::return_plugin_text_domain() ),
+ 'inline_dropdown' => __( 'Archived', self::return_plugin_text_domain() ),
+ 'press_this_dropdown' => __( 'Add to archives', self::return_plugin_text_domain() ),
),
);
@@ -1211,9 +1211,6 @@ class LH_archived_post_status_plugin {
}
-
-
-
public function __construct() {
//create the archived custom post status
@@ -1222,7 +1219,6 @@ class LH_archived_post_status_plugin {
//try to run everything on plugins loaded
add_action( 'plugins_loaded', array($this,'plugin_init'), 1000, 1);
-
}
Index: partials/option-settings.php
===================================================================
--- partials/option-settings.php (revision 3236713)
+++ partials/option-settings.php (working copy)
@@ -3,7 +3,7 @@
<?php wp_nonce_field( self::return_plugin_namespace()."-nonce", self::return_plugin_namespace()."-nonce", false ); ?>
<table class="form-table">
<tr valign="top">
-<th scope="row"><label for="<?php echo self::return_publicly_available(); ?>"><?php _e("Can Archived Posts be read publicly:", self::return_plugin_namespace()); ?></label></th>
+<th scope="row"><label for="<?php echo self::return_publicly_available(); ?>"><?php _e("Can Archived Posts be read publicly:", self::return_plugin_text_domain()); ?></label></th>
<td><select name="<?php echo self::return_publicly_available(); ?>" id="<?php echo self::return_publicly_available(); ?>">
<option value="1" <?php if ($options[self::return_publicly_available()] == 1){ echo 'selected="selected"'; } ?>>Yes - But not in the, main loop, frontpage, or feed</option>
<option value="0" <?php if ($options[self::return_publicly_available()] == 0){ echo 'selected="selected"';} ?>>No - only logged in users can view archived posts</option>
@@ -11,15 +11,15 @@
</td>
</tr>
<tr valign="top">
-<th scope="row"><label for="<?php echo self::return_title_label_field_name(); ?>"><?php _e("Title Label:", self::return_plugin_namespace()); ?></label>
+<th scope="row"><label for="<?php echo self::return_title_label_field_name(); ?>"><?php _e("Title Label:", self::return_plugin_text_domain()); ?></label>
</th>
-<td><input type="text" name="<?php echo self::return_title_label_field_name(); ?>" id="<?php echo self::return_title_label_field_name(); ?>" value="<?php echo $options[self::return_title_label_field_name()] ; ?>" size="20" /><br/><?php _e("This label will appear after the title for archived posts on the front end of your website", self::return_plugin_namespace()); ?>
+<td><input type="text" name="<?php echo self::return_title_label_field_name(); ?>" id="<?php echo self::return_title_label_field_name(); ?>" value="<?php echo $options[self::return_title_label_field_name()] ; ?>" size="20" /><br/><?php _e("This label will appear after the title for archived posts on the front end of your website", self::return_plugin_text_domain()); ?>
</td>
</tr>
<tr valign="top">
-<th scope="row"><label for="<?php echo self::return_message_field_name(); ?>"><?php _e("Archive Message:", self::return_plugin_namespace()); ?></label></th>
+<th scope="row"><label for="<?php echo self::return_message_field_name(); ?>"><?php _e("Archive Message:", self::return_plugin_text_domain()); ?></label></th>
<td>
<?php
$settings = array( 'media_buttons' => false );
The topic ‘[PATCH] fixing translations’ is closed to new replies.