Skip to content

Commit

Permalink
The translation function now includes the ability to replace text. Th…
Browse files Browse the repository at this point in the history
…e default setting is off.
  • Loading branch information
iworks committed Jan 11, 2023
1 parent 28aa0b4 commit edf84ae
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 35 deletions.
14 changes: 14 additions & 0 deletions etc/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ function orphang_indicator_options() {
'type' => 'heading',
'label' => __( 'Miscellaneous', 'sierotki' ),
),
/**
* Replace in Translations functions.
*
* Since 3.0.5
*/
array(
'name' => 'gettext',
'type' => 'checkbox',
'th' => __( 'Translation functions', 'sierotki' ),
'description' => __( 'Enabled the substitution of orphans in Translations functions. <a href="https://developer.wordpress.org/themes/functionality/internationalization/" target="_blank">Read more.</a>', 'sierotki' ),
'sanitize_callback' => 'absint',
'default' => 1,
'classes' => array( 'switch-button' ),
),
/**
* Since 2.6.8
*/
Expand Down
16 changes: 16 additions & 0 deletions includes/iworks/class-iworks-orphan.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ public function __construct() {
* iWorks Rate Class
*/
add_filter( 'iworks_rate_notice_logo_style', array( $this, 'filter_plugin_logo' ), 10, 2 );
/**
* Replace in Translations functions.
*
* Since 3.0.5
*/
if ( $this->options->get_option( 'gettext' ) ) {
add_filter( 'gettext', array( $this, 'filter_gettext' ), 10, 3 );
}
}

/**
Expand Down Expand Up @@ -676,5 +684,13 @@ public function filter_plugin_logo( $logo, $plugin ) {
return $logo;
}

/**
* Replace in Translations functions.
*
* Since 3.0.5
*/
public function filter_gettext( $translation, $text, $domain ) {
return $this->unconditional_replacement( $translation );
}
}

79 changes: 45 additions & 34 deletions languages/sierotki.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (C) 2022 Marcin Pietrzak
# Copyright (C) 2023 Marcin Pietrzak
# This file is distributed under the same license as the Orphans package.
msgid ""
msgstr ""
"Project-Id-Version: Orphans PLUGIN_VERSION\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/sierotki-dev\n"
"POT-Creation-Date: 2022-11-20 19:14:56+00:00\n"
"POT-Creation-Date: 2023-01-11 07:45:36+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2022-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: en\n"
Expand Down Expand Up @@ -120,119 +120,130 @@ msgstr ""
msgid "Miscellaneous"
msgstr ""

#: etc/options.php:151
#: etc/options.php:153
msgid "Translation functions"
msgstr ""

#: etc/options.php:154
msgid ""
"Enabled the substitution of orphans in Translations functions. <a "
"href=\"https://developer.wordpress.org/themes/functionality/"
"internationalization/\" target=\"_blank\">Read more.</a>"
msgstr ""

#: etc/options.php:165
msgid "Author description"
msgstr ""

#: etc/options.php:152
#: etc/options.php:166
msgid "Enabled the substitution of orphans in the author description."
msgstr ""

#: etc/options.php:159
#: etc/options.php:173
msgid "Ignore language"
msgstr ""

#: etc/options.php:161
#: etc/options.php:175
msgid "Allow to use plugin with another languages then Polish."
msgstr ""

#: etc/options.php:168
#: etc/options.php:182
msgid "Menu Title"
msgstr ""

#: etc/options.php:170
#: etc/options.php:184
msgid "Enabled the substitution of orphans in the menu title."
msgstr ""

#: etc/options.php:177
#: etc/options.php:191
msgid "Keep numbers together"
msgstr ""

#: etc/options.php:179
#: etc/options.php:193
msgid "Allow to keep together phone number or strings with space between numbers."
msgstr ""

#: etc/options.php:185
#: etc/options.php:199
msgid "Protect tag attributes"
msgstr ""

#: etc/options.php:187
#: etc/options.php:201
msgid "Allow to ignore spaces in \"class\", \"style\" and \"data-*\" attributes."
msgstr ""

#: etc/options.php:194
#: etc/options.php:208
msgid "User definied orphans"
msgstr ""

#: etc/options.php:196
#: etc/options.php:210
msgid "Use a comma to separate orphans."
msgstr ""

#: etc/options.php:203
#: etc/options.php:217
msgid "Entries custom fields"
msgstr ""

#: etc/options.php:205
#: etc/options.php:219
msgid "Use a comma to separate custom fields name."
msgstr ""

#: etc/options.php:213 etc/options.php:350
#: etc/options.php:227 etc/options.php:364
msgid "We are waiting for your message"
msgstr ""

#: etc/options.php:219
#: etc/options.php:233
msgid "I love what I do!"
msgstr ""

#: etc/options.php:232
#: etc/options.php:246
msgid "Integrations"
msgstr ""

#: etc/options.php:237
#: etc/options.php:251
msgid "Advanced Custom Fields"
msgstr ""

#: etc/options.php:242
#: etc/options.php:256
msgid "Text"
msgstr ""

#: etc/options.php:243
#: etc/options.php:257
msgid "Enabled the substitution of orphans in text fields."
msgstr ""

#: etc/options.php:251
#: etc/options.php:265
msgid "Textarea"
msgstr ""

#: etc/options.php:252
#: etc/options.php:266
msgid "Enabled the substitution of orphans in textarea fields. (Include WYSIWYG)."
msgstr ""

#: etc/options.php:260
#: etc/options.php:274
msgid "WYSIWYG"
msgstr ""

#: etc/options.php:261
#: etc/options.php:275
msgid "Enabled the substitution of orphans in WYSIWYG fields."
msgstr ""

#: etc/options.php:314
#: etc/options.php:328
msgid "Below are some links to help spread this plugin to other users"
msgstr ""

#: etc/options.php:316
#: etc/options.php:330
msgid "Give it a five stars on WordPress.org"
msgstr ""

#: etc/options.php:317
#: etc/options.php:331
msgid "Link to it so others can easily find it"
msgstr ""

#: etc/options.php:352
#: etc/options.php:366
msgid "WordPress Help Forum"
msgstr ""

#: includes/iworks/class-iworks-orphan.php:497
#: includes/iworks/class-iworks-orphan.php:505
#: includes/iworks/rate/rate.php:124
msgid "Settings"
msgstr ""
Expand Down Expand Up @@ -390,12 +401,12 @@ msgstr ""
msgid "http://iworks.pl/"
msgstr ""

#: etc/options.php:317
#: etc/options.php:331
msgctxt "plugin home page on WordPress.org"
msgid "https://wordpress.org/plugins/sierotki/"
msgstr ""

#: etc/options.php:352
#: etc/options.php:366
msgctxt "link to support forum on WordPress.org"
msgid "https://wordpress.org/support/plugin/sierotki/"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Orphans",
"description": "Plugin fix orphans position and replace space after orphan to hard space, to avoid ne break incorrect position.",
"tagline": "Plugin supports some of the grammatical rules of the Polish language.",
"version": "3.0.4",
"version": "3.0.5",
"homepage": "https://wordpress.org/plugins/sierotki/",
"tagline": "",
"repository": {
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ function remove_iworks_orphan_terms( $terms ) {

== Changelog ==

= 3.0.5 - 2023-01-11 =
* The translation function now includes the ability to replace text. The default setting is off.

= 3.0.4 - 2022-11-20 =
* Handle space after year for short year format "r.". Props for [Mastafu Design](https://wordpress.org/support/users/mastafu/)
* Added integration with "Goodlayers Core" on `gdlr_core_escape_content` filter.
Expand Down

0 comments on commit edf84ae

Please sign in to comment.