forked from TYPO3GmbH/site-intercept
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP][FEATURE] Allow docs language menu to sort by language and localize
ISO-Code DB: https://github.com/sokil/php-isocodes-db-i18n TYPO3 Core implementation (Data is generated from "Build/Scripts/updateIsoDatabase.php") https://github.com/TYPO3/typo3/blob/f5e53a75c39f85a49490af99bec73b6032f9bebc/typo3/sysext/core/Classes/Localization/OfficialLanguages.php#L23 Old variant of this: https://github.com/TYPO3-Documentation/typo3-docs-typo3-org-resources/blob/master/webroot/services/ajaxversions.php URL example: https://docs.typo3.org/services/ajaxversions.php?url=https://docs.typo3.org/m/typo3/tutorial-getting-started/12.4/en-us/Concepts/Index.html References TYPO3-Documentation/render-guides#358
- Loading branch information
1 parent
e361328
commit aec6c1e
Showing
9 changed files
with
3,081 additions
and
844 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sokil-php-isocodes-cache.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.