Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-basic-requirements
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-basic-requirements
Commits
5bcab0b9
Commit
5bcab0b9
authored
5 years ago
by
dyszczo
Browse files
Options
Downloads
Patches
Plain Diff
remove translation initialization
parent
649909a3
No related branches found
No related tags found
1 merge request
!20
translations
Pipeline
#9762
passed with warnings
5 years ago
Stage: tools
Stage: tests
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Basic_Requirement_Checker_Factory.php
+2
-30
2 additions, 30 deletions
src/Basic_Requirement_Checker_Factory.php
tests/unit/Test_Basic_Requirement_Checker_Factory.php
+0
-2
0 additions, 2 deletions
tests/unit/Test_Basic_Requirement_Checker_Factory.php
with
2 additions
and
32 deletions
src/Basic_Requirement_Checker_Factory.php
+
2
−
30
View file @
5bcab0b9
...
...
@@ -24,8 +24,7 @@ class WPDesk_Basic_Requirement_Checker_Factory {
* @return WPDesk_Requirement_Checker
*/
public
function
create_requirement_checker
(
$plugin_file
,
$plugin_name
,
$text_domain
=
null
)
{
return
new
WPDesk_Basic_Requirement_Checker
(
$plugin_file
,
$plugin_name
,
$this
->
initialize_translations
(
$text_domain
),
null
,
null
);
return
new
WPDesk_Basic_Requirement_Checker
(
$plugin_file
,
$plugin_name
,
$text_domain
,
null
,
null
);
}
/**
...
...
@@ -42,7 +41,7 @@ class WPDesk_Basic_Requirement_Checker_Factory {
$requirements_checker
=
new
WPDesk_Basic_Requirement_Checker_With_Update_Disable
(
$plugin_file
,
$plugin_name
,
$this
->
initialize_translations
(
$text_domain
)
,
$text_domain
,
$requirements
[
'php'
],
$requirements
[
'wp'
]
);
...
...
@@ -68,31 +67,4 @@ class WPDesk_Basic_Requirement_Checker_Factory {
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
;
}
}
This diff is collapsed.
Click to expand it.
tests/unit/Test_Basic_Requirement_Checker_Factory.php
+
0
−
2
View file @
5bcab0b9
...
...
@@ -24,8 +24,6 @@ class Test_Basic_Requirement_Checker_Factory extends PHPUnit\Framework\TestCase
WP_Mock
::
wpFunction
(
'get_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
();
$checker
=
$factory
->
create_from_requirement_array
(
'whatever'
,
'whatever'
,
$requirements
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment