Skip to content
Snippets Groups Projects
Commit 82c018ac authored by Erick Hitter's avatar Erick Hitter
Browse files

Fix translation support

parent e0de9b2b
No related branches found
No related tags found
1 merge request!14Fix translation support
Pipeline #4918 passed
This commit is part of merge request !14. Comments created here will be created in the context of that merge request.
......@@ -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: {
......
......@@ -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 ###
Fix translation support.
......@@ -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
......
......@@ -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>'
);
......
# 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&#8217; 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 "&quot;Latest post&quot; 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 "
......
......@@ -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">
......
......@@ -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 =
Fix translation support.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment