Skip to content
Snippets Groups Projects
Commit 98fa515d authored by Vasili Guruli's avatar Vasili Guruli
Browse files

Merge branch 'master' into 'feature/minimum-plugin-version-check-demo1'

# Conflicts:
#   src/Basic_Requirement_Checker_Factory.php
#   tests/unit/Test_Basic_Requirement_Checker_Factory.php
parents bd8ddd39 bd96be55
Branches
Tags
1 merge request!19Feature/minimum plugin version check demo1
Pipeline #10062 failed
## [3.1.0] - 2019-11-13
### Changed
- Removed .mo file
- Translation set in composer extra section
## [3.0.5] - 2019-09-20 ## [3.0.5] - 2019-09-20
### Fixed ### Fixed
- Fixed missing wp_create_nonce function - Fixed missing wp_create_nonce function
......
...@@ -24,6 +24,13 @@ ...@@ -24,6 +24,13 @@
"autoload-dev": { "autoload-dev": {
"classmap": ["src", "tests"] "classmap": ["src", "tests"]
}, },
"extra": {
"text-domain": "wp-basic-requirements",
"translations-folder": "lang",
"po-files": {
"pl_PL": "wp-basic-requirements-pl_PL.po"
}
},
"scripts": { "scripts": {
"phpcs": "phpcs", "phpcs": "phpcs",
"phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never", "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never",
......
File deleted
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
$requirements_checker = new WPDesk_Basic_Requirement_Checker_With_Update_Disable( $requirements_checker = new WPDesk_Basic_Requirement_Checker_With_Update_Disable(
$plugin_file, $plugin_file,
$plugin_name, $plugin_name,
$this->initialize_translations( $text_domain ), $text_domain,
$requirements['php'], $requirements['php'],
$requirements['wp'] $requirements['wp']
); );
...@@ -70,31 +70,4 @@ ...@@ -70,31 +70,4 @@
return $requirements_checker; return $requirements_checker;
} }
/**
* Tries to initialize translations for requirement checker. If not given then default library translation is used.
*
* @param string|null $text_domain
*
* @return string
*/
private function initialize_translations( $text_domain = null ) {
if ( $text_domain === null ) {
$text_domain = self::LIBRARY_TEXT_DOMAIN;
if ( function_exists( 'determine_locale' ) ) {
$locale = determine_locale();
} else { // before WP 5.0 compatibility
$locale = get_locale();
}
$locale = apply_filters( 'plugin_locale', $locale, self::LIBRARY_TEXT_DOMAIN );
$lang_mo_file = __DIR__ . '/../lang/' . self::LIBRARY_TEXT_DOMAIN . '-' . $locale . '.mo';
if ( file_exists( $lang_mo_file ) ) {
load_textdomain( self::LIBRARY_TEXT_DOMAIN, $lang_mo_file );
}
}
return $text_domain;
}
} }
\ No newline at end of file
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
array( array(
'name' => 'woocommerce/woocommerce.php', 'name' => 'woocommerce/woocommerce.php',
'nice_name' => 'WooCommerce', 'nice_name' => 'WooCommerce',
'version' => '1.0'
), ),
), ),
'repo_plugins' => array( 'repo_plugins' => array(
...@@ -25,8 +24,6 @@ ...@@ -25,8 +24,6 @@
WP_Mock::wpFunction( 'get_locale' ) WP_Mock::wpFunction( 'get_locale' )
->andReturn( $existing_locale ); ->andReturn( $existing_locale );
WP_Mock::wpFunction( 'load_textdomain' )
->once(); // locale pl_PL exists so it should try to load it
$factory = new WPDesk_Basic_Requirement_Checker_Factory(); $factory = new WPDesk_Basic_Requirement_Checker_Factory();
$checker = $factory->create_from_requirement_array( 'whatever', 'whatever', $requirements ); $checker = $factory->create_from_requirement_array( 'whatever', 'whatever', $requirements );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment