Closed Crizz0 closed 2 years ago
Maybe this is solved by the array-check. But the standard phpBB package does not include language files for the viglink extension, which is part of the core in 3.2. So it happend in the past, that changes there were missed by the translators completely.
I'm open to ideas on how this can be more robust.
For example, I'm still thinking about the best way to handle this case - when the user neither has the Viglink files in the origin en
directory or their own language folder. If we're using the origin folder as a source of truth, then is it appropriate for us to be hard-coding the Viglink checks separately.
My best thought at the moment is that the download command could run automatically on first use when not in safe mode (because we don't want that command run on .com). That way the files will always be in the origin directory and the user will get Missing required file
messages if they haven't got Viglink files of their own.
Here's what the PR above does:
Step 1: Say you run php translation.php validate de --phpbb-version=3.3 --display-notices
Step 2: You might get an error like:
Fatal in ext/phpbb/viglink/language/de/info_acp_viglink.php:
Found additional file
Fatal in ext/phpbb/viglink/language/de/viglink_module_acp.php:
Found additional file
Now, if you run it you'd get an error like this instead:
Fatal in ext/phpbb/viglink/language/de/info_acp_viglink.php:
No source file for the official extension found - to download, run: php translation.php download --files=phpbb-extensions/viglink
Fatal in ext/phpbb/viglink/language/de/viglink_module_acp.php:
No source file for the official extension found - to download, run: php translation.php download --files=phpbb-extensions/viglink
So the new script it prompts the user to run, does this:
vagrant@ubuntu-bionic:/var/www/html/phpbb-translation-validator$ php translation.php download --files=phpbb-extensions/viglink --phpbb-version=3.3
Downloading phpbb-extensions/viglink
Viglink directory does not exist, creating now at /vagrant/html/phpbb-translation-validator/src/Phpbb/TranslationValidator/Command/../../../../3.3/en/ext/phpbb/viglink/language/en/
Creating missing file now at /vagrant/html/phpbb-translation-validator/src/Phpbb/TranslationValidator/Command/../../../../3.3/en/ext/phpbb/viglink//language/en/info_acp_viglink.php
Creating missing file now at /vagrant/html/phpbb-translation-validator/src/Phpbb/TranslationValidator/Command/../../../../3.3/en/ext/phpbb/viglink//language/en/viglink_module_acp.php
Script complete.
Using the GitHub API, it will get the latest files and put them into the correct directory. Then when the user runs the original validation query again, it will all process properly because the origin files and user files exist.
This will avoid that people are missing those files and don't keep them up to date.
Regards