Skip to content

Commit 2ae856d

Browse files
committed
Add support for phpBB 3.2
1 parent 03f202f commit 2ae856d

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

src/Phpbb/TranslationValidator/Command/ValidateCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function configure()
2525
->setName('validate')
2626
->setDescription('Run the validator on your language pack.')
2727
->addArgument('origin-iso', InputArgument::REQUIRED, 'The ISO of the language to validate')
28-
->addOption('phpbb-version', null, InputOption::VALUE_OPTIONAL, 'The phpBB Version to validate against (3.0|3.1)', '3.0')
28+
->addOption('phpbb-version', null, InputOption::VALUE_OPTIONAL, 'The phpBB Version to validate against (3.0|3.1|3.2)', '3.1')
2929
->addOption('source-iso', null, InputOption::VALUE_OPTIONAL, 'The ISO of the language to validate against', 'en')
3030
->addOption('package-dir', null, InputOption::VALUE_OPTIONAL, 'The path to the directory with the language packages', null)
3131
->addOption('language-dir', null, InputOption::VALUE_OPTIONAL, 'The path to the directory with the language folders', null)
@@ -50,9 +50,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
5050
$debug = $input->getOption('debug');
5151
$displayNotices = $input->getOption('display-notices');
5252

53-
if (!in_array($phpbbVersion, array('3.0', '3.1')))
53+
if (!in_array($phpbbVersion, array('3.0', '3.1', '3.2')))
5454
{
55-
throw new \RuntimeException('Invalid phpbb-version, allowed versions: 3.0 and 3.1');
55+
throw new \RuntimeException('Invalid phpbb-version, allowed versions: 3.0, 3.1 and 3.2');
5656
}
5757

5858
$output = new Output($output, $debug);

src/Phpbb/TranslationValidator/Validator/FileListValidator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function setSource($sourceIso, $sourcePath, $sourceLanguagePath)
8383
/**
8484
* Set phpBB Version
8585
*
86-
* @param string $phpbbVersion The phpBB Version to validate against (3.0|3.1)
86+
* @param string $phpbbVersion The phpBB Version to validate against (3.0|3.1|3.2)
8787
* @return $this
8888
*/
8989
public function setPhpbbVersion($phpbbVersion)
@@ -191,6 +191,10 @@ public function validate()
191191
{
192192
$level = Output::NOTICE;
193193
}
194+
else if ($this->phpbbVersion === '3.2' && strpos($origin_file, 'styles/subsilver2/') === 0)
195+
{
196+
$level = Output::FATAL;
197+
}
194198
else
195199
{
196200
$level = (substr($origin_file, -3) !== '.md') ? Output::FATAL : Output::ERROR;

src/Phpbb/TranslationValidator/Validator/FileValidator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function setSource($sourceIso, $sourcePath, $sourceLanguagePath)
8686
/**
8787
* Set phpBB Version
8888
*
89-
* @param string $phpbbVersion The phpBB Version to validate against (3.0|3.1)
89+
* @param string $phpbbVersion The phpBB Version to validate against (3.0|3.1|3.2)
9090
* @return $this
9191
*/
9292
public function setPhpbbVersion($phpbbVersion)
@@ -171,7 +171,7 @@ public function validate($sourceFile, $originFile)
171171
{
172172
$this->validateIsoFile($originFile);
173173
}
174-
else if ($this->phpbbVersion == '3.1' && substr($originFile, -4) === '.css')
174+
else if ($this->phpbbVersion !== '3.0' && substr($originFile, -4) === '.css')
175175
{
176176
$this->validateUtf8withoutbom($originFile);
177177
$this->validateCSSFile($sourceFile, $originFile);
@@ -338,7 +338,7 @@ public function validateEmail($sourceFile, $originFile)
338338
// Check for new liens at the end of the file
339339
if (end($originContent) !== '')
340340
{
341-
$level = ($this->phpbbVersion == '3.1') ? Output::FATAL : Output::NOTICE;
341+
$level = ($this->phpbbVersion !== '3.0') ? Output::FATAL : Output::NOTICE;
342342
$this->output->addMessage($level, 'Missing new line at the end of the file', $originFile);
343343
}
344344
}
@@ -582,7 +582,7 @@ public function validateUtf8withoutbom($originFile)
582582
*/
583583
public function validateNoPhpClosingTag($originFile)
584584
{
585-
if ($this->phpbbVersion == '3.0')
585+
if ($this->phpbbVersion === '3.0')
586586
{
587587
return;
588588
}

src/Phpbb/TranslationValidator/Validator/LangKeyValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function setSource($sourceIso, $sourcePath, $sourceLanguagePath)
9696
/**
9797
* Set phpBB Version
9898
*
99-
* @param string $phpbbVersion The phpBB Version to validate against (3.0|3.1)
99+
* @param string $phpbbVersion The phpBB Version to validate against (3.0|3.1|3.2)
100100
* @return $this
101101
*/
102102
public function setPhpbbVersion($phpbbVersion)
@@ -575,7 +575,7 @@ public function validateString($file, $key, $against_language, $validate_languag
575575
{
576576
$level = Output::FATAL;
577577
// phpBB 3.0 Plural workarounds
578-
if ($this->phpbbVersion == '3.0' && abs($against_integers - $validate_integers) === 1 &&
578+
if ($this->phpbbVersion === '3.0' && abs($against_integers - $validate_integers) === 1 &&
579579
($this->originLanguagePath . 'common.php' === $file && $key === 'VIEW_ONLINE_TIME')
580580
)
581581
{

src/Phpbb/TranslationValidator/Validator/ValidatorRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function setSource($sourceIso, $sourcePath, $sourceLanguagePath)
9797
/**
9898
* Set phpBB Version
9999
*
100-
* @param string $phpbbVersion The phpBB Version to validate against (3.0|3.1)
100+
* @param string $phpbbVersion The phpBB Version to validate against (3.0|3.1|3.2)
101101
* @return $this
102102
*/
103103
public function setPhpbbVersion($phpbbVersion)

0 commit comments

Comments
 (0)