38 $this->markTestSkipped(
'MAGETWO-26083');
39 $failures = $this->
comparePhrase($phrases, $this->csvParser->getDataPairs($file));
55 $optionResolver = $optionResolverFactory->create(
BP,
true);
57 $parser->parse($optionResolver->getOptions());
60 foreach ($parser->getPhrases() as $key => $phrase) {
61 if (!$phrase->getContextType() || !$phrase->getContextValue()) {
62 throw new \RuntimeException(sprintf(
'Missed context in row #%d.', $key + 1));
64 foreach ($phrase->getContextValue() as
$context) {
68 $defaultLocale[$file][
'file'] = $file;
69 $defaultLocale[$file][
'phrases'][$phraseText] = $phraseTranslation;
72 return $defaultLocale;
91 if ($this->context ===
null) {
102 $filesCollector = new \Magento\Setup\Module\I18n\FilesCollector();
104 $phraseCollector = new \Magento\Setup\Module\I18n\Parser\Adapter\Php\Tokenizer\PhraseCollector(
105 new \
Magento\Setup\Module\I18n\
Parser\Adapter\Php\Tokenizer()
108 'php' => new \Magento\Setup\Module\I18n\Parser\Adapter\Php($phraseCollector),
109 'js' => new \Magento\Setup\Module\I18n\Parser\Adapter\Js(),
110 'xml' => new \Magento\Setup\Module\I18n\Parser\Adapter\Xml(),
111 'html' => new \Magento\Setup\Module\I18n\Parser\Adapter\Html(),
114 $parserContextual = new \Magento\Setup\Module\I18n\Parser\Contextual(
123 return $parserContextual;
132 return preg_replace([
'/\\\\\'/',
'/\\\\\\\\/'], [
'\'',
'\\'],
$text);
144 $this->markTestSkipped(
'MAGETWO-26083');
148 foreach (
$files as $locale => $file) {
149 $fileData = $this->csvParser->getDataPairs($file);
150 foreach ($fileData as $key => $translate) {
151 preg_match_all(
'/%(\d+)/', $key, $keyMatches);
152 preg_match_all(
'/%(\d+)/', $translate, $translateMatches);
153 if (count(array_unique($keyMatches[1])) != count(array_unique($translateMatches[1]))) {
154 $failures[$locale][$key][] = $translate;
162 'Found discrepancy between keys and translations in count of numeric placeholders'
testPhrasePlaceHolders($placePath)
testDefaultLocale($file, $phrases)
eliminateSpecialChars($text)
const DEFAULT_SYSTEM_LOCALE
printMessage($failures, $message='')
comparePhrase($baseLocaleData, $localeData)
buildFilePath($phrase, $context)
defaultLocaleDataProvider()
foreach($appDirs as $dir) $files