Skip to content

Commit

Permalink
[WIP][FEATURE] Allow docs language menu to sort by language and localize
Browse files Browse the repository at this point in the history
  • Loading branch information
garvinhicking committed May 27, 2024
1 parent e361328 commit aec6c1e
Show file tree
Hide file tree
Showing 9 changed files with 3,081 additions and 844 deletions.
11 changes: 11 additions & 0 deletions legacy_hook/GARVIN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TODO Garvin:

* Actually parse `sokil/php-isocodes-db-i18n` output in `src/Composer/IsoLanguageCacheCreator.php`
* Add Unit test for the parsing method
* Adjust `src/DocumentationVersions.php` to read the cache (if existing) for version selector
* Adjust Unit test for expectation vs. result of the version selector
* Figure out testing for deployment (TYPO3 GmbH)
* Remove dummy cli-ajaxversions.php
* Remove GARVIN.md
* Squash commit this

1 change: 1 addition & 0 deletions legacy_hook/auto-generated/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sokil-php-isocodes-cache.php
3 changes: 3 additions & 0 deletions legacy_hook/auto-generated/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory will hold auto-generated data.

For now this will be the files created from parsing sokil/php-isocodes-db-i18n.
60 changes: 60 additions & 0 deletions legacy_hook/cli-ajaxversions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
declare(strict_types = 1);

/*
* This file is part of the package t3g/intercept-legacy-hook.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

// TODO: REMOVE THIS
require __DIR__ . '/vendor/autoload.php';

use App\DocumentationVersions;
use App\ResponseEmitter;
use GuzzleHttp\Psr7\ServerRequest;

// Fake it till you make it
$_REQUEST['url'] = $_GET['url'] = 'https://docs.typo3.org/m/typo3/tutorial-getting-started/12.4/en-us/Index.html';
$GLOBALS['_SERVER']['DOCUMENT_ROOT'] = '/tmp/fake-docs.typo3.org/';

$versions = [
'9.4',
'10.5',
'11.5',
'12.4',
'main',
];
$languages = [
'de-de' => 'GERMAN',
'en-us' => 'DEFAULT',
'ru-ru' => 'RUSSIAN',
'fr-fr' => 'FRENCH',
'de-AT' => 'GERMAN (AUSTRIAN)',
'de-CH' => 'GERMAN (SWISS)',
];
$subdirectories = [
'Concepts',
'singlehtml',
];

$struct = [];
foreach ($versions as $version) {
$struct[$version] = [];
foreach ($languages as $language => $languageName) {
mkdir($GLOBALS['_SERVER']['DOCUMENT_ROOT'] . '/m/typo3/tutorial-getting-started/' . $version . '/' . $language . '/', 0777, true);
touch($GLOBALS['_SERVER']['DOCUMENT_ROOT'] . '/m/typo3/tutorial-getting-started/' . $version . '/' . $language . '/Index.html');

foreach ($subdirectories as $subdirectory) {
mkdir($GLOBALS['_SERVER']['DOCUMENT_ROOT'] . '/m/typo3/tutorial-getting-started/' . $version . '/' . $language . '/' . $subdirectory, 0777, true);
touch($GLOBALS['_SERVER']['DOCUMENT_ROOT'] . '/m/typo3/tutorial-getting-started/' . $version . '/' . $language . '/' . $subdirectory . '/Index.html');
}
}
}

print_r($struct);

$response = (new DocumentationVersions(ServerRequest::fromGlobals()))->getVersions();

print_r($response);
12 changes: 10 additions & 2 deletions legacy_hook/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,27 @@
"guzzlehttp/guzzle": "^7.7",
"guzzlehttp/psr7": "^2.5",
"psr/http-message": "^1.1",
"symfony/finder": "^5.4"
"symfony/finder": "^5.4",
"sokil/php-isocodes-db-i18n": "^4.0.22"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"phpunit/phpunit": "^10.2",
"mikey179/vfsstream": "^1.6.11"
"mikey179/vfsstream": "^1.6.11",
"composer/composer": "^2.7.6"
},
"scripts": {
"t3g:test:php:unit": [
"phpunit"
],
"t3g:test": [
"@t3g:test:php:unit"
],
"post-install-cmd": [
"App\\Composer\\IsoLanguageCacheCreator::createCacheRepresentation"
],
"post-update-cmd": [
"App\\Composer\\IsoLanguageCacheCreator::createCacheRepresentation"
]
}
}
Loading

0 comments on commit aec6c1e

Please sign in to comment.