diff --git a/composer.json b/composer.json index 827789e..d375122 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,8 @@ "require": { "php": "^7.2.5", "twig/twig": "^3.0", - "amphp/parallel": "^1.4" + "amphp/parallel": "^1.4", + "phpmyadmin/twig-i18n-extension": "^4.0" }, "license": "MIT", "authors": [ diff --git a/composer.lock b/composer.lock index 26bc6d2..6c16168 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4053556a32d0a974795f8ab1ee625ae1", + "content-hash": "6202f57b53ac8b2d5ad750bb4c02ff0f", "packages": [ { "name": "amphp/amp", @@ -174,16 +174,16 @@ }, { "name": "amphp/parallel", - "version": "v1.4.2", + "version": "v1.4.3", "source": { "type": "git", "url": "https://github.com/amphp/parallel.git", - "reference": "75853e1623efa5aa5e65e986ec9a97db573a5267" + "reference": "3aac213ba7858566fd83d38ccb85b91b2d652cb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/parallel/zipball/75853e1623efa5aa5e65e986ec9a97db573a5267", - "reference": "75853e1623efa5aa5e65e986ec9a97db573a5267", + "url": "https://api.github.com/repos/amphp/parallel/zipball/3aac213ba7858566fd83d38ccb85b91b2d652cb0", + "reference": "3aac213ba7858566fd83d38ccb85b91b2d652cb0", "shasum": "" }, "require": { @@ -236,7 +236,7 @@ ], "support": { "issues": "https://github.com/amphp/parallel/issues", - "source": "https://github.com/amphp/parallel/tree/v1.4.2" + "source": "https://github.com/amphp/parallel/tree/v1.4.3" }, "funding": [ { @@ -244,7 +244,7 @@ "type": "github" } ], - "time": "2022-12-30T00:21:42+00:00" + "time": "2023-03-23T08:04:23+00:00" }, { "name": "amphp/parser", @@ -499,6 +499,62 @@ ], "time": "2021-10-25T18:29:10+00:00" }, + { + "name": "phpmyadmin/twig-i18n-extension", + "version": "v4.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpmyadmin/twig-i18n-extension.git", + "reference": "c0d0dd171cd1c7733bf152fd44b61055843df052" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmyadmin/twig-i18n-extension/zipball/c0d0dd171cd1c7733bf152fd44b61055843df052", + "reference": "c0d0dd171cd1c7733bf152fd44b61055843df052", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "twig/twig": "^1.42.3|^2.0|^3.0" + }, + "require-dev": { + "phpmyadmin/coding-standard": "^3.0.0", + "phpmyadmin/motranslator": "^5.2", + "phpstan/phpstan": "^0.12.66", + "phpunit/phpunit": "^7 || ^8 || ^9" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpMyAdmin\\Twig\\Extensions\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "The phpMyAdmin Team", + "email": "developers@phpmyadmin.net", + "homepage": "https://www.phpmyadmin.net/team/" + } + ], + "description": "Internationalization support for Twig via the gettext library", + "keywords": [ + "gettext", + "i18n" + ], + "support": { + "issues": "https://github.com/phpmyadmin/twig-i18n-extension/issues", + "source": "https://github.com/phpmyadmin/twig-i18n-extension" + }, + "time": "2021-06-10T15:53:38+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.27.0", @@ -666,16 +722,16 @@ }, { "name": "twig/twig", - "version": "v3.5.1", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15" + "reference": "106c170d08e8415d78be2d16c3d057d0d108262b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/a6e0510cc793912b451fd40ab983a1d28f611c15", - "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/106c170d08e8415d78be2d16c3d057d0d108262b", + "reference": "106c170d08e8415d78be2d16c3d057d0d108262b", "shasum": "" }, "require": { @@ -684,15 +740,10 @@ "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { - "psr/container": "^1.0", + "psr/container": "^1.0|^2.0", "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.5-dev" - } - }, "autoload": { "psr-4": { "Twig\\": "src/" @@ -726,7 +777,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.5.1" + "source": "https://github.com/twigphp/Twig/tree/v3.6.0" }, "funding": [ { @@ -738,7 +789,7 @@ "type": "tidelift" } ], - "time": "2023-02-08T07:49:20+00:00" + "time": "2023-05-03T19:06:57+00:00" } ], "packages-dev": [], diff --git a/config.php.dist b/config.php.dist index 3942e09..fbc126b 100644 --- a/config.php.dist +++ b/config.php.dist @@ -40,4 +40,15 @@ $options = [ 'fullhour' => 8, // make hosts full-check at that hour (0-23). Usage of out-of-range value or at other hours, checker will validate only enabled domains. 'checkthreads' => 64, // checker threads amount + + 'exportperiod' => 4, // lists update period in hours as configured in crontab, used only for fomatting home page +]; + +/* Twig template engine configuration */ +$twigTplDir = __DIR__ . '/templates'; // templates directory +$twigMsgDir = __DIR__ . '/messages'; // translations directory + +$twigConfig = [ + 'cache' => __DIR__ . '/cache', + 'auto_reload' => true, ]; diff --git a/lib/twig.php b/lib/twig.php new file mode 100644 index 0000000..82dae59 --- /dev/null +++ b/lib/twig.php @@ -0,0 +1,18 @@ +addExtension(new I18nExtension()); + +bindtextdomain('regi2p', $twigMsgDir); +bind_textdomain_codeset('regi2p', 'UTF-8'); + +textdomain('regi2p'); diff --git a/messages/.gitkeep b/messages/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/templates/_page.twig b/templates/_page.twig index 8bd1830..9a63f5f 100644 --- a/templates/_page.twig +++ b/templates/_page.twig @@ -26,7 +26,7 @@ {% if all %} {% endif %} - +