From 337a763ef1af15b889675bae5a96f810fc0de088 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sat, 25 Jun 2022 11:25:07 -0700 Subject: [PATCH] Fix i18n --- Gruntfile.js | 2 +- languages/tag-dropdown-widget.pot | 74 +++++++++++++++---------------- phpcs.xml | 2 +- tag-dropdown-widget.php | 74 +++++++++++++++++++------------ 4 files changed, 84 insertions(+), 68 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 61f6fcd..a075399 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,7 +9,7 @@ module.exports = function( grunt ) { addtextdomain: { options: { - textdomain: 'taxonomy_dropdown_widget', + textdomain: 'tag-dropdown-widget', }, update_all_domains: { options: { diff --git a/languages/tag-dropdown-widget.pot b/languages/tag-dropdown-widget.pot index ac9b863..8f41767 100644 --- a/languages/tag-dropdown-widget.pot +++ b/languages/tag-dropdown-widget.pot @@ -1,143 +1,143 @@ -# Copyright (C) 2021 Erick Hitter +# Copyright (C) 2022 Erick Hitter # This file is distributed under the same license as the Taxonomy Dropdown Widget package. msgid "" msgstr "" "Project-Id-Version: Taxonomy Dropdown Widget 2.3.1\n" "Report-Msgid-Bugs-To: " "https://wordpress.org/support/plugin/tag-dropdown-widget\n" -"POT-Creation-Date: 2021-03-27 21:17:12+00:00\n" +"POT-Creation-Date: 2022-06-25 18:24:14+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2021-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" -#: tag-dropdown-widget.php:550 +#: tag-dropdown-widget.php:566 msgid "Basic Settings" msgstr "" -#: tag-dropdown-widget.php:553 +#: tag-dropdown-widget.php:569 msgid "Taxonomy" msgstr "" -#: tag-dropdown-widget.php:562 +#: tag-dropdown-widget.php:578 msgid "Title:" msgstr "" -#: tag-dropdown-widget.php:567 +#: tag-dropdown-widget.php:583 msgid "Default dropdown item:" msgstr "" -#: tag-dropdown-widget.php:571 +#: tag-dropdown-widget.php:587 msgid "Order" msgstr "" -#: tag-dropdown-widget.php:574 +#: tag-dropdown-widget.php:590 msgid "Order terms by:" msgstr "" -#: tag-dropdown-widget.php:577 +#: tag-dropdown-widget.php:593 msgid "Name" msgstr "" -#: tag-dropdown-widget.php:580 +#: tag-dropdown-widget.php:596 msgid "Post count" msgstr "" -#: tag-dropdown-widget.php:584 +#: tag-dropdown-widget.php:600 msgid "Order terms:" msgstr "" -#: tag-dropdown-widget.php:587 +#: tag-dropdown-widget.php:603 msgid "Ascending" msgstr "" -#: tag-dropdown-widget.php:590 +#: tag-dropdown-widget.php:606 msgid "Descending" msgstr "" -#: tag-dropdown-widget.php:593 +#: tag-dropdown-widget.php:609 msgid "Term Display" msgstr "" -#: tag-dropdown-widget.php:596 +#: tag-dropdown-widget.php:612 msgid "Limit number of terms shown to:" msgstr "" -#: tag-dropdown-widget.php:598 +#: tag-dropdown-widget.php:614 msgid "Enter <strong>0</strong> for no limit." msgstr "" -#: tag-dropdown-widget.php:602 +#: tag-dropdown-widget.php:618 msgid "Trim long term names to <em>x</em> characters:</label>" msgstr "" -#: tag-dropdown-widget.php:604 +#: tag-dropdown-widget.php:620 msgid "Enter <strong>0</strong> to show full tag names." msgstr "" -#: tag-dropdown-widget.php:608 +#: tag-dropdown-widget.php:624 msgid "Indicator that term names are trimmed:" msgstr "" -#: tag-dropdown-widget.php:610 +#: tag-dropdown-widget.php:626 msgid "Leave blank to use an elipsis (…)." msgstr "" -#: tag-dropdown-widget.php:615 +#: tag-dropdown-widget.php:631 msgid "Include terms that aren't assigned to any objects (empty terms)." msgstr "" -#: tag-dropdown-widget.php:620 +#: tag-dropdown-widget.php:636 msgid "Display object (post) counts after term names." msgstr "" -#: tag-dropdown-widget.php:623 +#: tag-dropdown-widget.php:639 msgid "Include/Exclude Terms" msgstr "" -#: tag-dropdown-widget.php:626 +#: tag-dropdown-widget.php:642 msgid "Include/exclude terms:" msgstr "" -#: tag-dropdown-widget.php:629 +#: tag-dropdown-widget.php:645 msgid "Include only the term IDs listed below" msgstr "" -#: tag-dropdown-widget.php:632 +#: tag-dropdown-widget.php:648 msgid "Exclude the term IDs listed below" msgstr "" -#: tag-dropdown-widget.php:636 +#: tag-dropdown-widget.php:652 msgid "Term IDs to include/exclude based on above setting:" msgstr "" -#: tag-dropdown-widget.php:638 +#: tag-dropdown-widget.php:654 msgid "Enter comma-separated list of term IDs." msgstr "" -#: tag-dropdown-widget.php:641 +#: tag-dropdown-widget.php:657 msgid "Advanced" msgstr "" -#: tag-dropdown-widget.php:644 +#: tag-dropdown-widget.php:660 msgid "Show terms assigned to at least this many posts:" msgstr "" -#: tag-dropdown-widget.php:646 +#: tag-dropdown-widget.php:662 msgid "Set to <strong>0</strong> to display all terms matching the above criteria." msgstr "" @@ -164,4 +164,4 @@ msgstr "" #. Author URI of the plugin/theme msgid "https://ethitter.com/" -msgstr "" \ No newline at end of file +msgstr "" diff --git a/phpcs.xml b/phpcs.xml index 3f154fc..efe6c62 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="taxonomy_dropdown_widget"/> + <property name="text_domain" type="array" value="tag-dropdown-widget"/> </properties> </rule> <rule ref="WordPress.WhiteSpace.ControlStructureSpacing"> diff --git a/tag-dropdown-widget.php b/tag-dropdown-widget.php index ed5124c..75955cc 100644 --- a/tag-dropdown-widget.php +++ b/tag-dropdown-widget.php @@ -7,6 +7,8 @@ Description: Creates a dropdown list of non-hierarchical taxonomies as an altern Author: Erick Hitter Version: 2.3.1 Author URI: https://ethitter.com/ +Text Domain: tag-dropdown-widget +Domain Path: /languages/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -78,6 +80,7 @@ class taxonomy_dropdown_widget_plugin { * @return null */ protected function setup() { + add_action( 'plugin_loaded', array( $this, 'load_textdomain' ) ); add_action( 'widgets_init', array( $this, 'action_widgets_init' ) ); register_activation_hook( __FILE__, array( $this, 'activation_hook' ) ); @@ -99,6 +102,19 @@ class taxonomy_dropdown_widget_plugin { return null; } + /** + * Load plugin translations. + * + * @return void + */ + public function load_textdomain() { + load_plugin_textdomain( + 'tag-dropdown-widget', + false, + dirname( __FILE__ ) . '/languages/' + ); + } + /** * Run plugin cleanup on activation * @uses this::cleanup @@ -547,10 +563,10 @@ class taxonomy_dropdown_widget extends WP_Widget { } ?> - <h3><?php _e( 'Basic Settings', 'taxonomy_dropdown_widget' ); ?></h3> + <h3><?php _e( 'Basic Settings', 'tag-dropdown-widget' ); ?></h3> <p> - <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>"><?php _e( 'Taxonomy', 'taxonomy_dropdown_widget' ); ?>:</label><br /> + <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>"><?php _e( 'Taxonomy', 'tag-dropdown-widget' ); ?>:</label><br /> <select name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>"> <?php foreach ( $taxonomies as $tax ) : ?> <option value="<?php echo esc_attr( $tax->name ); ?>"<?php selected( $tax->name, $options['taxonomy'], true ); ?>><?php echo $tax->labels->name; ?></option> @@ -559,91 +575,91 @@ class taxonomy_dropdown_widget extends WP_Widget { </p> <p> - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'tag-dropdown-widget' ); ?></label><br /> <input type="text" name="<?php echo $this->get_field_name( 'title' ); ?>" class="widefat code" id="<?php echo $this->get_field_id( 'title' ); ?>" value="<?php echo esc_attr( $options['title'] ); ?>" /> </p> <p> - <label for="<?php echo $this->get_field_id( 'select_name' ); ?>"><?php _e( 'Default dropdown item:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_id( 'select_name' ); ?>"><?php _e( 'Default dropdown item:', 'tag-dropdown-widget' ); ?></label><br /> <input type="text" name="<?php echo $this->get_field_name( 'select_name' ); ?>" class="widefat code" id="<?php echo $this->get_field_id( 'select_name' ); ?>" value="<?php echo esc_attr( $options['select_name'] ); ?>" /> </p> - <h3><?php _e( 'Order', 'taxonomy_dropdown_widget' ); ?></h3> + <h3><?php _e( 'Order', 'tag-dropdown-widget' ); ?></h3> <p> - <label><?php _e( 'Order terms by:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label><?php _e( 'Order terms by:', 'tag-dropdown-widget' ); ?></label><br /> <input type="radio" name="<?php echo $this->get_field_name( 'orderby' ); ?>" value="name" id="<?php echo $this->get_field_name( 'order_name' ); ?>"<?php checked( $options['orderby'], 'name', true ); ?> /> - <label for="<?php echo $this->get_field_name( 'order_name' ); ?>"><?php _e( 'Name', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_name( 'order_name' ); ?>"><?php _e( 'Name', 'tag-dropdown-widget' ); ?></label><br /> <input type="radio" name="<?php echo $this->get_field_name( 'orderby' ); ?>" value="count" id="<?php echo $this->get_field_name( 'order_count' ); ?>"<?php checked( $options['orderby'], 'count', true ); ?> /> - <label for="<?php echo $this->get_field_name( 'order_count' ); ?>"><?php _e( 'Post count', 'taxonomy_dropdown_widget' ); ?></label> + <label for="<?php echo $this->get_field_name( 'order_count' ); ?>"><?php _e( 'Post count', 'tag-dropdown-widget' ); ?></label> </p> <p> - <label><?php _e( 'Order terms:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label><?php _e( 'Order terms:', 'tag-dropdown-widget' ); ?></label><br /> <input type="radio" name="<?php echo $this->get_field_name( 'order' ); ?>" value="ASC" id="<?php echo $this->get_field_name( 'order_asc' ); ?>"<?php checked( $options['order'], 'ASC', true ); ?> /> - <label for="<?php echo $this->get_field_name( 'order_asc' ); ?>"><?php _e( 'Ascending', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_name( 'order_asc' ); ?>"><?php _e( 'Ascending', 'tag-dropdown-widget' ); ?></label><br /> <input type="radio" name="<?php echo $this->get_field_name( 'order' ); ?>" value="DESC" id="<?php echo $this->get_field_name( 'order_desc' ); ?>"<?php checked( $options['order'], 'DESC', true ); ?> /> - <label for="<?php echo $this->get_field_name( 'order_desc' ); ?>"><?php _e( 'Descending', 'taxonomy_dropdown_widget' ); ?></label> + <label for="<?php echo $this->get_field_name( 'order_desc' ); ?>"><?php _e( 'Descending', 'tag-dropdown-widget' ); ?></label> </p> - <h3><?php _e( 'Term Display', 'taxonomy_dropdown_widget' ); ?></h3> + <h3><?php _e( 'Term Display', 'tag-dropdown-widget' ); ?></h3> <p> - <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Limit number of terms shown to:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Limit number of terms shown to:', 'tag-dropdown-widget' ); ?></label><br /> <input type="text" name="<?php echo $this->get_field_name( 'limit' ); ?>" id="<?php echo $this->get_field_id( 'limit' ); ?>" value="<?php echo intval( $options['limit'] ); ?>" size="3" /><br /> - <span class="description"><small><?php _e( 'Enter <strong>0</strong> for no limit.', 'taxonomy_dropdown_widget' ); ?></small></span> + <span class="description"><small><?php _e( 'Enter <strong>0</strong> for no limit.', 'tag-dropdown-widget' ); ?></small></span> </p> <p> - <label for="<?php echo $this->get_field_id( 'max_name_length' ); ?>"><?php _e( 'Trim long term names to <em>x</em> characters:</label>', 'taxonomy_dropdown_widget' ); ?><br /> + <label for="<?php echo $this->get_field_id( 'max_name_length' ); ?>"><?php _e( 'Trim long term names to <em>x</em> characters:</label>', 'tag-dropdown-widget' ); ?><br /> <input type="text" name="<?php echo $this->get_field_name( 'max_name_length' ); ?>" id="<?php echo $this->get_field_id( 'max_name_length' ); ?>" value="<?php echo intval( $options['max_name_length'] ); ?>" size="3" /><br /> - <span class="description"><small><?php _e( 'Enter <strong>0</strong> to show full tag names.', 'taxonomy_dropdown_widget' ); ?></small></span> + <span class="description"><small><?php _e( 'Enter <strong>0</strong> to show full tag names.', 'tag-dropdown-widget' ); ?></small></span> </p> <p> - <label for="<?php echo $this->get_field_id( 'cutoff' ); ?>"><?php _e( 'Indicator that term names are trimmed:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_id( 'cutoff' ); ?>"><?php _e( 'Indicator that term names are trimmed:', 'tag-dropdown-widget' ); ?></label><br /> <input type="text" name="<?php echo $this->get_field_name( 'cutoff' ); ?>" id="<?php echo $this->get_field_id( 'cutoff' ); ?>" value="<?php echo esc_attr( $options['cutoff'] ); ?>" size="3" /><br /> - <span class="description"><small><?php _e( 'Leave blank to use an elipsis (…).', 'taxonomy_dropdown_widget' ); ?></small></span> + <span class="description"><small><?php _e( 'Leave blank to use an elipsis (…).', 'tag-dropdown-widget' ); ?></small></span> </p> <p> <input type="checkbox" name="<?php echo $this->get_field_name( 'hide_empty' ); ?>" id="<?php echo $this->get_field_id( 'hide_empty' ); ?>" value="0"<?php checked( false, $options['hide_empty'], true ); ?> /> - <label for="<?php echo $this->get_field_id( 'hide_empty' ); ?>"><?php _e( 'Include terms that aren\'t assigned to any objects (empty terms).', 'taxonomy_dropdown_widget' ); ?></label> + <label for="<?php echo $this->get_field_id( 'hide_empty' ); ?>"><?php _e( 'Include terms that aren\'t assigned to any objects (empty terms).', 'tag-dropdown-widget' ); ?></label> </p> <p> <input type="checkbox" name="<?php echo $this->get_field_name( 'post_counts' ); ?>" id="<?php echo $this->get_field_id( 'post_counts' ); ?>" value="1"<?php checked( true, $options['post_counts'], true ); ?> /> - <label for="<?php echo $this->get_field_id( 'post_counts' ); ?>"><?php _e( 'Display object (post) counts after term names.', 'taxonomy_dropdown_widget' ); ?></label> + <label for="<?php echo $this->get_field_id( 'post_counts' ); ?>"><?php _e( 'Display object (post) counts after term names.', 'tag-dropdown-widget' ); ?></label> </p> - <h3><?php _e( 'Include/Exclude Terms', 'taxonomy_dropdown_widget' ); ?></h3> + <h3><?php _e( 'Include/Exclude Terms', 'tag-dropdown-widget' ); ?></h3> <p> - <label><?php _e( 'Include/exclude terms:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label><?php _e( 'Include/exclude terms:', 'tag-dropdown-widget' ); ?></label><br /> <input type="radio" name="<?php echo $this->get_field_name( 'incexc' ); ?>" value="include" id="<?php echo $this->get_field_id( 'include' ); ?>"<?php checked( $options['incexc'], 'include', true ); ?> /> - <label for="<?php echo $this->get_field_id( 'include' ); ?>"><?php _e( 'Include only the term IDs listed below', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_id( 'include' ); ?>"><?php _e( 'Include only the term IDs listed below', 'tag-dropdown-widget' ); ?></label><br /> <input type="radio" name="<?php echo $this->get_field_name( 'incexc' ); ?>" value="exclude" id="<?php echo $this->get_field_id( 'exclude' ); ?>"<?php checked( $options['incexc'], 'exclude', true ); ?> /> - <label for="<?php echo $this->get_field_id( 'exclude' ); ?>"><?php _e( 'Exclude the term IDs listed below', 'taxonomy_dropdown_widget' ); ?></label> + <label for="<?php echo $this->get_field_id( 'exclude' ); ?>"><?php _e( 'Exclude the term IDs listed below', 'tag-dropdown-widget' ); ?></label> </p> <p> - <label for="<?php echo $this->get_field_id( 'incexc_ids' ); ?>"><?php _e( 'Term IDs to include/exclude based on above setting:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_id( 'incexc_ids' ); ?>"><?php _e( 'Term IDs to include/exclude based on above setting:', 'tag-dropdown-widget' ); ?></label><br /> <input type="text" name="<?php echo $this->get_field_name( 'incexc_ids' ); ?>" class="widefat code" id="<?php echo $this->get_field_id( 'incexc_ids' ); ?>" value="<?php echo esc_attr( implode( ', ', $options['incexc_ids'] ) ); ?>" /><br /> - <span class="description"><small><?php _e( 'Enter comma-separated list of term IDs.', 'taxonomy_dropdown_widget' ); ?></small></span> + <span class="description"><small><?php _e( 'Enter comma-separated list of term IDs.', 'tag-dropdown-widget' ); ?></small></span> </p> - <h3><?php _e( 'Advanced', 'taxonomy_dropdown_widget' ); ?></h3> + <h3><?php _e( 'Advanced', 'tag-dropdown-widget' ); ?></h3> <p> - <label for="<?php echo $this->get_field_id( 'threshold' ); ?>"><?php _e( 'Show terms assigned to at least this many posts:', 'taxonomy_dropdown_widget' ); ?></label><br /> + <label for="<?php echo $this->get_field_id( 'threshold' ); ?>"><?php _e( 'Show terms assigned to at least this many posts:', 'tag-dropdown-widget' ); ?></label><br /> <input type="text" name="<?php echo $this->get_field_name( 'threshold' ); ?>" id="<?php echo $this->get_field_id( 'threshold' ); ?>" value="<?php echo intval( $options['threshold'] ); ?>" size="3" /><br /> - <span class="description"><small><?php _e( 'Set to <strong>0</strong> to display all terms matching the above criteria.', 'taxonomy_dropdown_widget' ); ?></small></span> + <span class="description"><small><?php _e( 'Set to <strong>0</strong> to display all terms matching the above criteria.', 'tag-dropdown-widget' ); ?></small></span> </p> <?php -- GitLab