Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
static
testsuite
Magento
Test
Integrity
App
Language
TranslationFiles.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Test\Integrity\App\Language
;
7
8
use
Magento\Framework\Component\ComponentRegistrar
;
9
use
Magento\Framework\Filesystem\Driver\File
;
10
11
class
TranslationFiles
extends
\PHPUnit\Framework\TestCase
12
{
16
protected
$csvParser
;
17
18
protected
function
setUp
()
19
{
20
$this->csvParser = new \Magento\Framework\File\Csv(
new
File
());
21
}
22
26
public
function
getLocalePlacePath
()
27
{
28
$pathToSource =
BP
;
29
$places = [];
30
$componentRegistrar
=
new
ComponentRegistrar
();
31
foreach
(
$componentRegistrar
->getPaths(
ComponentRegistrar::MODULE
) as $modulePath) {
32
$places[basename($modulePath)] = [
'placePath'
=> $modulePath];
33
}
34
foreach
(
$componentRegistrar
->getPaths(
ComponentRegistrar::THEME
) as $themePath) {
35
$placeName = basename(dirname(dirname($themePath))) .
'_'
. basename($themePath);
36
$places[$placeName] = [
'placePath'
=> $themePath];
37
}
38
$places[
'lib_web'
] = [
'placePath'
=>
"{$pathToSource}/lib/web"
];
39
return
$places;
40
}
41
46
protected
function
getCsvFiles
($modulePath)
47
{
48
$files
= [];
49
foreach
(glob(
"{$modulePath}/i18n/*.csv"
) as $file) {
50
$locale = str_replace(
'.csv'
,
''
, basename($file));
51
$files
[$locale] = $file;
52
}
53
return
$files
;
54
}
55
61
protected
function
comparePhrase
($baseLocaleData, $localeData)
62
{
63
$missing = array_diff_key($baseLocaleData, $localeData);
64
$extra
= array_diff_key($localeData, $baseLocaleData);
65
66
$failures = [];
67
if
(!empty($missing)) {
68
$failures[
'missing'
] = array_keys($missing);
69
}
70
if
(!empty(
$extra
)) {
71
$failures[
'extra'
] = array_keys(
$extra
);
72
}
73
return
$failures;
74
}
75
81
protected
function
printMessage
($failures,
$message
=
''
)
82
{
83
$message
.= PHP_EOL;
84
foreach
($failures as $locale => $localeErrors) {
85
$message
.= $locale . PHP_EOL;
86
foreach
($localeErrors as $typeError => $error) {
87
$message
.= PHP_EOL .
"##########"
. PHP_EOL . ucfirst($typeError) .
':'
. PHP_EOL;
88
foreach
($error as $phrase) {
89
$message
.=
'"'
. $phrase .
'","'
. $phrase .
'"'
. PHP_EOL;
90
}
91
}
92
}
93
return
$message
;
94
}
95
}
Magento\Test\Integrity\App\Language\TranslationFiles\setUp
setUp()
Definition:
TranslationFiles.php:18
$componentRegistrar
$componentRegistrar
Definition:
bootstrap.php:23
Magento\Test\Integrity\App\Language\TranslationFiles
Definition:
TranslationFiles.php:11
$message
$message
Definition:
notifications.php:7
Magento\Test\Integrity\App\Language\TranslationFiles\getCsvFiles
getCsvFiles($modulePath)
Definition:
TranslationFiles.php:46
Magento\Framework\Component\ComponentRegistrar\THEME
const THEME
Definition:
ComponentRegistrar.php:23
Magento\Framework\Component\ComponentRegistrar\MODULE
const MODULE
Definition:
ComponentRegistrar.php:21
Magento\Test\Integrity\App\Language\TranslationFiles\getLocalePlacePath
getLocalePlacePath()
Definition:
TranslationFiles.php:26
Magento\Test\Integrity\App\Language\TranslationFiles\$csvParser
$csvParser
Definition:
TranslationFiles.php:16
Magento\Framework\Filesystem\Driver\File
Definition:
File.php:20
Magento\Test\Integrity\App\Language
Definition:
CircularDependencyTest.php:7
Magento\Test\Integrity\App\Language\TranslationFiles\printMessage
printMessage($failures, $message='')
Definition:
TranslationFiles.php:81
Magento\Framework\Component\ComponentRegistrar
Definition:
ComponentRegistrar.php:16
Magento\Test\Integrity\App\Language\TranslationFiles\comparePhrase
comparePhrase($baseLocaleData, $localeData)
Definition:
TranslationFiles.php:61
BP
const BP
Definition:
autoload.php:14
$files
foreach($appDirs as $dir) $files
Definition:
app_dirs_rollback.php:18
$extra
if( $_orders &&count( $_orders))( 'Orders') ?></caption >< thead >< tr >< th scopeforeach( $_orders as $_order)(__( 'Order #')) ?>" class $extra
Definition:
history.phtml:32