Skip to content

Commit 4992912

Browse files
committed
Allows additional images .gif or .png for rtl translations
1 parent 4a85e75 commit 4992912

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/Phpbb/TranslationValidator/Validator/FileListValidator.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ public function validate()
120120
$sourceFiles[] = $this->sourceLanguagePath . 'LICENSE';
121121
$sourceFiles = array_unique($sourceFiles);
122122

123+
/*
124+
* Get $lang['direction'] of translation to allow additional rtl-files for rtl-translations
125+
*/
126+
include($this->originPath . '/' . $this->originLanguagePath . 'common.php');
127+
$direction = $lang['DIRECTION'];
128+
// Throw error, if invalid direction is used
129+
if (!in_array($direction, array('rtl', 'ltr')))
130+
{
131+
$this->output->addMessage(Output::FATAL, 'DIRECTION needs to be rtl or ltr');
132+
}
133+
123134
$originFiles = $this->getFileList($this->originPath);
124135

125136
$missingSubsilver2Files = $availableSubsilver2Files = array();
@@ -195,10 +206,16 @@ public function validate()
195206
{
196207
$level = Output::FATAL;
197208
}
198-
else
199-
{
200-
$level = (substr($origin_file, -3) !== '.md') ? Output::FATAL : Output::ERROR;
209+
else if (substr($origin_file, -4 === array('.gif', '.png')) && $direction === 'rtl') {
210+
$level = Output::WARNING;
201211
}
212+
else if (substr($origin_file, -3) !== '.md') {
213+
$level = Output::FATAL;
214+
}
215+
else {
216+
$level = Output::ERROR;
217+
}
218+
202219
$this->output->addMessage($level, 'Found additional file', $origin_file);
203220
}
204221
}

0 commit comments

Comments
 (0)