diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e63a15852f6900996d9c80d69167849572b6383..5b8a91d466cb7aa3f85c7d38c3e6ea1a4d11d517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## [2.0.0] - 2021-00-07 +## [Unreleased] +### Added +- added the possibility to translate common phrases + +## [2.0.0] - 2021-01-07 ### Added - plugin shops in WPDesk_Plugin_Info diff --git a/composer.json b/composer.json index 426d7d1b31f3482831ee0bddf0b32feba19dc3df..5b3d80dadb28253bf838a66956093b12d72cb19b 100644 --- a/composer.json +++ b/composer.json @@ -1,33 +1,44 @@ { - "name": "wpdesk/wp-builder", - "authors": [ - { - "name": "Krzysiek", - "email": "krzysiek@wpdesk.pl" - } - ], - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "<7", - "wp-coding-standards/wpcs": "^0.14.1", - "squizlabs/php_codesniffer": "^3.0.2", - "mockery/mockery": "*", - "10up/wp_mock": "*", - "wimg/php-compatibility": "^8" - }, - "autoload": { - "psr-4": {"WPDesk\\PluginBuilder\\": "src/"}, - "classmap": ["src/Plugin/WithoutNamespace"] - }, - "autoload-dev": { - }, - "scripts": { - "phpcs": "phpcs", - "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never", - "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage", - "phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never", - "phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage" - } + "name": "wpdesk/wp-builder", + "authors": [ + { + "name": "Krzysiek", + "email": "krzysiek@wpdesk.pl" + } + ], + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "<7", + "wp-coding-standards/wpcs": "^0.14.1", + "squizlabs/php_codesniffer": "^3.0.2", + "mockery/mockery": "*", + "10up/wp_mock": "*", + "wimg/php-compatibility": "^8" + }, + "autoload": { + "psr-4": { + "WPDesk\\PluginBuilder\\": "src/" + }, + "classmap": [ + "src/Plugin/WithoutNamespace" + ] + }, + "autoload-dev": { + }, + "extra": { + "text-domain": "wpdesk-wp-builder", + "translations-folder": "lang", + "po-files": { + "pl_PL": "pl_PL.po" + } + }, + "scripts": { + "phpcs": "phpcs", + "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never", + "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage", + "phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never", + "phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage" + } } diff --git a/lang/pl_PL.po b/lang/pl_PL.po new file mode 100644 index 0000000000000000000000000000000000000000..9de15681b2f431899a56d349e88c2beff859eacd --- /dev/null +++ b/lang/pl_PL.po @@ -0,0 +1,25 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2023-12-11T11:29:44+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.8.1\n" +"X-Domain: wpdesk-wp-builder\n" + +#: Plugin/AbstractPlugin.php:195 +msgid "Support" +msgstr "Wsparcie" + +#: Plugin/AbstractPlugin.php:201 +msgid "Docs" +msgstr "Dokumentacja" + +#: Plugin/AbstractPlugin.php:208 +msgid "Settings" +msgstr "Ustawienia" diff --git a/phpcs.xml.dist b/phpcs.xml.dist index b736f2578f2af84a07fbedde80459660d1565408..cf074340419c278c057884f94929cb17ee00ae55 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -9,7 +9,7 @@ <rule ref="WordPress"/> - <config name="text_domain" value="wpdesk-plugin,default,s214-settings-demo"/> + <config name="text_domain" value="wpdesk-wp-builder"/> <arg name="extensions" value="php"/> diff --git a/src/Plugin/AbstractPlugin.php b/src/Plugin/AbstractPlugin.php index 61c1569b3900b675063a5d73388622fcb2ac2681..51f5969b6236ebaebc3d60679a0525cf6cb99fe8 100644 --- a/src/Plugin/AbstractPlugin.php +++ b/src/Plugin/AbstractPlugin.php @@ -166,8 +166,8 @@ abstract class AbstractPlugin extends SlimPlugin { public function load_plugin_text_domain() { load_plugin_textdomain( $this->get_text_domain(), false, $this->get_namespace() . '/lang/' ); } - /** + * Append JS scripts in the WordPress admin panel. This is a hook function. Do not execute directly. * * @return void @@ -198,20 +198,20 @@ abstract class AbstractPlugin extends SlimPlugin { } $plugin_links = [ - '<a target="_blank" href="' . $support_link . '">' . __( 'Support', $this->get_text_domain() ) . '</a>', + '<a target="_blank" href="' . $support_link . '">' . esc_html__( 'Support', 'wpdesk-wp-builder' ) . '</a>', ]; $links = array_merge( $plugin_links, $links ); if ( $this->docs_url ) { $plugin_links = [ - '<a target="_blank" href="' . $this->docs_url . '">' . __( 'Docs', $this->get_text_domain() ) . '</a>', + '<a target="_blank" href="' . $this->docs_url . '">' . esc_html__( 'Docs', 'wpdesk-wp-builder' ) . '</a>', ]; $links = array_merge( $plugin_links, $links ); } if ( $this->settings_url ) { $plugin_links = [ - '<a href="' . $this->settings_url . '">' . __( 'Settings', $this->get_text_domain() ) . '</a>', + '<a href="' . $this->settings_url . '">' . esc_html__( 'Settings', 'wpdesk-wp-builder' ) . '</a>', ]; $links = array_merge( $plugin_links, $links ); }