@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhorgeInternationalizationManagementValidateWorkflow
4 extends PhabricatorInternationalizationManagementWorkflow {
5
6 protected function didConstruct() {
7 $this
8 ->setName('validate')
9 ->setExamples(
10 '**validate** [__options__]')
11 ->setSynopsis(pht(
12 'Validate that all locales and translations are properly constructed.'))
13 ->setArguments(
14 array(
15 array(
16 'name' => 'extract',
17 'help' => pht(
18 'Do an implicit string extraction before validating. '.
19 'If this is not set, it will validate based on the last '.
20 'extracted strings.'),
21 ),
22 ));
23 }
24 public function execute(PhutilArgumentParser $args) {
25 $validator = new PhorgeInternationalizationValidator();
26 $do_extract = $args->getArg('extract');
27 $json = $validator->loadExtractions($do_extract);
28 $errors = $validator->validateLibraries($json);
29 if (!count($errors)) {
30 echo pht('No validation errors found!').PHP_EOL;
31 } else {
32 echo pht('The following validation errors were found:').PHP_EOL;
33 foreach ($errors as $error) {
34 echo $error.PHP_EOL;
35 }
36 }
37 }
38}