diff --git a/Gruntfile.js b/Gruntfile.js index 01e53e741956dfadcc7168f2094c767053cca96b..1c531570e806aa091115af162e265257305df174 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,7 +9,7 @@ module.exports = function( grunt ) { addtextdomain: { options: { - textdomain: 'eth_redirect_to_latest_post', + textdomain: 'eth-redirect-to-latest-post', }, update_all_domains: { options: { diff --git a/README.md b/README.md index bf41892a65fc36f0684b713a4a67df1e9f884a9b..83ee979f3013e59d427c8dc23522b63ec183793d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **Tags:** latest, latest post, redirect, redirect latest, redirect post **Requires at least:** 4.5 **Tested up to:** 6.0 -**Stable tag:** 0.3 +**Stable tag:** 0.3.1 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -28,6 +28,9 @@ Yes, using the `eth_redirect_to_latest_post_query_args` or `eth_redirect_to_late ## Changelog ## +### 0.3.1 ### +* Fix translation support. + ### 0.3 ### * Introduce filters to make redirection more flexible. * Add unit tests and conform to coding standards. @@ -40,3 +43,8 @@ Yes, using the `eth_redirect_to_latest_post_query_args` or `eth_redirect_to_late ### 0.2 ### * Initial release + +## Upgrade Notice ## + +### 0.3.1 ### +Fixes translation support. diff --git a/eth-redirect-to-latest.php b/eth-redirect-to-latest.php index bfe4f39e87a27d4fae810c7308a89969b76ce7e6..4065ca665c424aa951d81aabb3c9cacc70bf7113 100644 --- a/eth-redirect-to-latest.php +++ b/eth-redirect-to-latest.php @@ -10,9 +10,9 @@ * Plugin URI: https://ethitter.com/plugins/ * Description: Redirect a chosen slug to the whatever is currently the latest post * Author: Erick Hitter - * Version: 0.3 + * Version: 0.3.1 * Author URI: https://ethitter.com/ - * Text Domain: eth_redirect_to_latest_post + * Text Domain: eth-redirect-to-latest-post * Domain Path: /languages/ * * This program is free software; you can redistribute it and/or modify diff --git a/inc/class-eth-redirect-to-latest-post.php b/inc/class-eth-redirect-to-latest-post.php index 721ab4664cb13a70a74ee366714f7477f624a6b6..e03b54a7ea72892106c0ed530127fb96991e9df6 100644 --- a/inc/class-eth-redirect-to-latest-post.php +++ b/inc/class-eth-redirect-to-latest-post.php @@ -35,14 +35,14 @@ class ETH_Redirect_To_Latest_Post { * Dummy magic method. */ public function __clone() { - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'eth_redirect_to_latest_post' ), '0.1' ); + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'eth-redirect-to-latest-post' ), '0.1' ); } /** * Dummy magic method. */ public function __wakeup() { - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'eth_redirect_to_latest_post' ), '0.1' ); + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'eth-redirect-to-latest-post' ), '0.1' ); } /** @@ -81,17 +81,31 @@ class ETH_Redirect_To_Latest_Post { * Register plugin's setup action. */ private function __construct() { + add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) ); add_action( 'init', array( $this, 'action_init' ) ); add_action( 'parse_request', array( $this, 'action_parse_request' ) ); add_action( 'admin_init', array( $this, 'action_admin_init' ) ); } + /** + * Load plugin translations. + * + * @return void + */ + public function load_textdomain() { + load_plugin_textdomain( + 'eth-redirect-to-latest-post', + false, + dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' + ); + } + /** * Translate plugin slug. */ public function action_init() { - $this->default_slug = __( 'latest', 'eth_redirect_to_latest_post' ); + $this->default_slug = __( 'latest', 'eth-redirect-to-latest-post' ); $_slug = get_option( $this->plugin_option_name, $this->default_slug ); @@ -236,7 +250,7 @@ class ETH_Redirect_To_Latest_Post { } // Add custom input field to permalinks screen. - add_settings_field( $this->plugin_option_name, __( '"Latest post" slug', 'eth_redirect_to_latest_post' ), array( $this, 'settings_field' ), 'permalink', 'optional' ); + add_settings_field( $this->plugin_option_name, __( '"Latest post" slug', 'eth-redirect-to-latest-post' ), array( $this, 'settings_field' ), 'permalink', 'optional' ); } /** @@ -252,7 +266,7 @@ class ETH_Redirect_To_Latest_Post { /* translators: 1. Default slug, wrapped in a <code> tag. */ esc_html__( 'Set the slug that will redirect to the latest published post. The default value is %s.', - 'eth_redirect_to_latest_post' + 'eth-redirect-to-latest-post' ), '<code style="font-style: normal;">' . esc_html( $this->default_slug ) . '</code>' ); diff --git a/languages/eth-redirect-to-latest.pot b/languages/eth-redirect-to-latest.pot index 5806211dd84cb03831d8aa6d7f91b4890e01139e..79327e1b54dfdbd7446253ff7c80e1decd11f9bc 100644 --- a/languages/eth-redirect-to-latest.pot +++ b/languages/eth-redirect-to-latest.pot @@ -1,44 +1,44 @@ -# Copyright (C) 2020 Erick Hitter +# Copyright (C) 2022 Erick Hitter # This file is distributed under the same license as the ETH Redirect to Latest Post package. msgid "" msgstr "" -"Project-Id-Version: ETH Redirect to Latest Post 0.3\n" +"Project-Id-Version: ETH Redirect to Latest Post 0.3.1\n" "Report-Msgid-Bugs-To: " -"https://wordpress.org/support/plugin/eth-redirect-to-latest\n" -"POT-Creation-Date: 2020-03-26 15:40:36+00:00\n" +"https://wordpress.org/support/plugin/eth-redirect-to-latest-post\n" +"POT-Creation-Date: 2022-06-25 22:34:10+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2022-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" -"X-Generator: grunt-wp-i18n 0.5.4\n" -"X-Poedit-KeywordsList: " -"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_" -"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n" "Language: en\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-Country: United States\n" "X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: " +"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_" +"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n" "X-Poedit-Basepath: ../\n" "X-Poedit-SearchPath-0: .\n" "X-Poedit-Bookmarks: \n" "X-Textdomain-Support: yes\n" +"X-Generator: grunt-wp-i18n 1.0.3\n" #: inc/class-eth-redirect-to-latest-post.php:38 #: inc/class-eth-redirect-to-latest-post.php:45 msgid "Cheatin’ uh?" msgstr "" -#: inc/class-eth-redirect-to-latest-post.php:94 +#: inc/class-eth-redirect-to-latest-post.php:108 msgid "latest" msgstr "" -#: inc/class-eth-redirect-to-latest-post.php:239 +#: inc/class-eth-redirect-to-latest-post.php:253 msgid ""Latest post" slug" msgstr "" -#: inc/class-eth-redirect-to-latest-post.php:253 +#: inc/class-eth-redirect-to-latest-post.php:267 #. translators: 1. Default slug, wrapped in a <code> tag. msgid "" "Set the slug that will redirect to the latest published post. The default " diff --git a/phpcs.xml b/phpcs.xml index b3a4ebac4651390158b0d5a4b3c1df6056ca2e45..a4677426a0a4a16e513c0c55876749d93d04ec11 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -39,7 +39,7 @@ <rule ref="WordPress.WP.I18n"> <properties> <!-- Value: replace the text domain used. --> - <property name="text_domain" type="array" value="eth_redirect_to_latest_post"/> + <property name="text_domain" type="array" value="eth-redirect-to-latest-post"/> </properties> </rule> <rule ref="WordPress.WhiteSpace.ControlStructureSpacing"> diff --git a/readme.txt b/readme.txt index bdfeed744adfa664ae0c3c5d26dfef48f564e68a..c00fa9a3fb5e2c24982c938028c2be951b998bd7 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://ethitter.com/donate/ Tags: latest, latest post, redirect, redirect latest, redirect post Requires at least: 4.5 Tested up to: 6.0 -Stable tag: 0.3 +Stable tag: 0.3.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -28,6 +28,9 @@ Yes, using the `eth_redirect_to_latest_post_query_args` or `eth_redirect_to_late == Changelog == += 0.3.1 = +* Fix translation support. + = 0.3 = * Introduce filters to make redirection more flexible. * Add unit tests and conform to coding standards. @@ -40,3 +43,8 @@ Yes, using the `eth_redirect_to_latest_post_query_args` or `eth_redirect_to_late = 0.2 = * Initial release + +== Upgrade Notice == + += 0.3.1 = +Fixes translation support.