Skip to content

Commit

Permalink
DocGen patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikuolan committed Jul 3, 2024
1 parent 76b80b4 commit 5c026c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/DocGen.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
$Vendor = __DIR__ . DIRECTORY_SEPARATOR . 'vendor';

$loadL10N = function (string $Language) use (&$Vendor) {
if (!file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'DocGen' . DIRECTORY_SEPARATOR . $Language . '.yml')) {
echo 'Unable to read the "' . $Language . '" language files!';
die;
}
$DataDocGen = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'DocGen' . DIRECTORY_SEPARATOR . $Language . '.yml');
$Language = preg_replace('~-.*$~', '', $Language);
if (
!file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'DocGen' . DIRECTORY_SEPARATOR . $Language . '.yml') ||
!file_exists($Vendor . DIRECTORY_SEPARATOR . 'phpmussel' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'l10n' . DIRECTORY_SEPARATOR . $Language . '.yml') ||
!file_exists($Vendor . DIRECTORY_SEPARATOR . 'phpmussel' . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'l10n' . DIRECTORY_SEPARATOR . $Language . '.yml') ||
!file_exists($Vendor . DIRECTORY_SEPARATOR . 'phpmussel' . DIRECTORY_SEPARATOR . 'phpmailer' . DIRECTORY_SEPARATOR . 'l10n' . DIRECTORY_SEPARATOR . $Language . '.yml')
Expand All @@ -13,8 +18,11 @@
die;
}
$YAML = new \Maikuolan\Common\YAML();
if (file_exists($Vendor . DIRECTORY_SEPARATOR . 'phpmussel' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'references.yml')) {
$Data = file_get_contents($Vendor . DIRECTORY_SEPARATOR . 'phpmussel' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'references.yml');
$YAML->process($Data, $YAML->Refs);
}
$Arr = [];
$DataDocGen = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'DocGen' . DIRECTORY_SEPARATOR . $Language . '.yml');
$YAML->process($DataDocGen, $Arr);
foreach (['frontend', 'web', 'phpmailer'] as $Dir) {
$DataThisDir = file_get_contents($Vendor . DIRECTORY_SEPARATOR . 'phpmussel' . DIRECTORY_SEPARATOR . $Dir . DIRECTORY_SEPARATOR . 'l10n' . DIRECTORY_SEPARATOR . $Language . '.yml');
Expand Down

0 comments on commit 5c026c7

Please sign in to comment.