Skip to content

Commit 0a6ece6

Browse files
committed
More fixes for the text domain.
1 parent 7c4bd85 commit 0a6ece6

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

plugins/hwp-previews/hwp-previews.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ function hwp_previews_constants(): void {
5858
'HWP_PREVIEWS_AUTOLOAD' => true,
5959
'HWP_PREVIEWS_SETTINGS_GROUP' => 'hwp_previews_settings_group',
6060
'HWP_PREVIEWS_SETTINGS_KEY' => 'hwp_previews_settings',
61+
'HWP_PREVIEWS_TEXT_DOMAIN' => 'hwp-previews',
6162
];
6263

6364
foreach ( $constants as $name => $value ) {
@@ -106,5 +107,13 @@ static function (): void {
106107
);
107108
}
108109

110+
/**
111+
* Load plugin textdomain.
112+
*/
113+
function hwp_previews_load_textdomain(): void {
114+
load_plugin_textdomain( 'hwp-previews', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
115+
}
116+
add_action( 'init', 'hwp_previews_load_textdomain', 1, 0);
117+
109118
/** @psalm-suppress HookNotFound */
110119
add_action( 'plugins_loaded', 'hwp_previews_init', 15, 0 );

plugins/hwp-previews/src/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected static function require_autoloader( string $autoloader_file ): bool {
5959
* Displays a notice if the autoloader is missing.
6060
*/
6161
protected static function missing_autoloader_notice(): void {
62-
$error_message = __( 'HWP Previews: The Composer autoloader was not found. If you installed the plugin from the GitHub source, make sure to run `composer install`.', 'hwp-previews' );
62+
$error_message = 'HWP Previews: The Composer autoloader was not found. If you installed the plugin from the GitHub source, make sure to run `composer install`.';
6363

6464
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
6565
error_log( esc_html( $error_message ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- This is a development notice.

plugins/hwp-previews/src/Preview/Parameter/Preview_Parameter_Registry.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ public static function get_instance(): self {
5050
public static function add_initial_parameters( self $instance ): self {
5151
$instance
5252
->register(
53-
new Preview_Parameter( 'ID', static fn( WP_Post $post ) => (string) $post->ID, __( 'Post ID.', 'hwp-previews' ) )
53+
new Preview_Parameter( 'ID', static fn( WP_Post $post ) => (string) $post->ID, 'Post ID.' )
5454
)->register(
55-
new Preview_Parameter( 'author_ID', static fn( WP_Post $post ) => $post->post_author, __( 'ID of post author..', 'hwp-previews' ) )
55+
new Preview_Parameter( 'author_ID', static fn( WP_Post $post ) => $post->post_author, 'ID of post author.')
5656
)->register(
57-
new Preview_Parameter( 'status', static fn( WP_Post $post ) => $post->post_status, __( 'The post\'s status..', 'hwp-previews' ) )
57+
new Preview_Parameter( 'status', static fn( WP_Post $post ) => $post->post_status, 'The post status.' )
5858
)->register(
59-
new Preview_Parameter( 'slug', static fn( WP_Post $post ) => $post->post_name, __( 'The post\'s slug.', 'hwp-previews' ) )
59+
new Preview_Parameter( 'slug', static fn( WP_Post $post ) => $post->post_name, 'The post slug.' )
6060
)->register(
61-
new Preview_Parameter( 'parent_ID', static fn( WP_Post $post ) => (string) $post->post_parent, __( 'ID of a post\'s parent post.', 'hwp-previews' ) )
61+
new Preview_Parameter( 'parent_ID', static fn( WP_Post $post ) => (string) $post->post_parent, 'ID of a post parent post.' )
6262
)->register(
63-
new Preview_Parameter( 'type', static fn( WP_Post $post ) => $post->post_type, __( 'The post\'s type, like post or page.', 'hwp-previews' ) )
63+
new Preview_Parameter( 'type', static fn( WP_Post $post ) => $post->post_type, 'The post type, like post or page.' )
6464
)->register(
65-
new Preview_Parameter( 'uri', static fn( WP_Post $post ) => (string) get_page_uri( $post ), __( 'The URI path for a page.', 'hwp-previews' ) )
65+
new Preview_Parameter( 'uri', static fn( WP_Post $post ) => (string) get_page_uri( $post ), 'The URI path for a page.' )
6666
)->register(
67-
new Preview_Parameter( 'template', static fn( WP_Post $post ) => (string) get_page_template_slug( $post ), __( 'Specific template filename for a given post.', 'hwp-previews' ) )
67+
new Preview_Parameter( 'template', static fn( WP_Post $post ) => (string) get_page_template_slug( $post ), 'Specific template filename for a given post.' )
6868
);
6969

7070
// Allow users to register/unregister parameters.

0 commit comments

Comments
 (0)