From b2f26ac31121bbb7b609a348402ffe1eff671fd4 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Sun, 12 Jul 2026 16:03:24 +0400 Subject: [PATCH 1/2] [#533] Update project Lang config for adapter support --- composer.json | 2 +- helpers/functions.php | 2 +- shared/config/lang.php | 30 +++++++++++++++++++++++++++--- tests/_root/helpers/functions.php | 2 +- tests/_root/shared/config/lang.php | 27 +++++++++++++++++++++++++-- 5 files changed, 55 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 437308a..d1c01f7 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "type": "project", "require": { "php": "^8.0", - "quantum/framework": "^3.0.3", + "quantum/framework": "dev-master", "fakerphp/faker": "^1.15", "bluemmb/faker-picsum-photos-provider": "^2.0", "ottaviano/faker-gravatar": "^0.3.0", diff --git a/helpers/functions.php b/helpers/functions.php index 78af19d..34bea2e 100644 --- a/helpers/functions.php +++ b/helpers/functions.php @@ -21,7 +21,7 @@ function url_with_lang(string $lang): string { if (!in_array($lang, (array) config()->get('lang.supported'))) { - $lang = config()->get('lang.default'); + $lang = config()->get('lang.default_locale'); } if (trim(route_uri()) == '/') { diff --git a/shared/config/lang.php b/shared/config/lang.php index 407b240..0d8111f 100644 --- a/shared/config/lang.php +++ b/shared/config/lang.php @@ -3,11 +3,35 @@ return [ /** * --------------------------------------------------------- - * Multilingual settings + * Language configurations * --------------------------------------------------------- */ - 'enabled' => true, + 'default' => 'deepl', 'supported' => ['en', 'es'], - 'default' => 'en', + 'default_locale' => 'en', 'url_segment' => 1, + 'file' => [], + 'deepl' => [ + 'use_source_catalog' => true, + 'auth_key' => '', + 'api_url' => '', + 'source_locale' => 'en', + 'cache' => [ + 'enabled' => true, + 'default' => 'file', + 'ttl' => 3600, + 'prefix' => 'lang_deepl:', + ], + ], + 'google_translate' => [ + 'use_source_catalog' => true, + 'api_key' => '', + 'source_locale' => 'en', + 'cache' => [ + 'enabled' => true, + 'default' => 'file', + 'ttl' => 3600, + 'prefix' => 'lang_google_translate:', + ], + ], ]; diff --git a/tests/_root/helpers/functions.php b/tests/_root/helpers/functions.php index c34e57c..c2c0a8c 100644 --- a/tests/_root/helpers/functions.php +++ b/tests/_root/helpers/functions.php @@ -6,7 +6,7 @@ function url_with_lang(string $lang): string { if (!in_array($lang, (array) config()->get('lang.supported'))) { - $lang = config()->get('lang.default'); + $lang = config()->get('lang.default_locale'); } if (trim(route_uri()) == '/') { diff --git a/tests/_root/shared/config/lang.php b/tests/_root/shared/config/lang.php index 8f1675a..7f754a9 100644 --- a/tests/_root/shared/config/lang.php +++ b/tests/_root/shared/config/lang.php @@ -6,8 +6,31 @@ * Multilingual settings * --------------------------------------------------------- */ - 'enabled' => true, 'supported' => ['en', 'ru', 'am'], - 'default' => 'en', + 'default' => 'file', + 'default_locale' => 'en', + 'file' => [], 'url_segment' => 1, + 'deepl' => [ + 'use_source_catalog' => true, + 'auth_key' => '', + 'source_locale' => 'en', + 'cache' => [ + 'enabled' => true, + 'default' => 'file', + 'ttl' => 3600, + 'prefix' => 'lang_deepl:', + ], + ], + 'google_translate' => [ + 'use_source_catalog' => true, + 'api_key' => '', + 'source_locale' => 'en', + 'cache' => [ + 'enabled' => true, + 'default' => 'file', + 'ttl' => 3600, + 'prefix' => 'lang_google_translate:', + ], + ], ]; From 0feac2c9245f822450c675ce84fca6288b1a0489 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Sun, 12 Jul 2026 16:18:37 +0400 Subject: [PATCH 2/2] [#533] Adjust project Lang starter config --- shared/config/lang.php | 3 +-- tests/_root/shared/config/lang.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/shared/config/lang.php b/shared/config/lang.php index 0d8111f..b013b45 100644 --- a/shared/config/lang.php +++ b/shared/config/lang.php @@ -6,7 +6,7 @@ * Language configurations * --------------------------------------------------------- */ - 'default' => 'deepl', + 'default' => 'file', 'supported' => ['en', 'es'], 'default_locale' => 'en', 'url_segment' => 1, @@ -14,7 +14,6 @@ 'deepl' => [ 'use_source_catalog' => true, 'auth_key' => '', - 'api_url' => '', 'source_locale' => 'en', 'cache' => [ 'enabled' => true, diff --git a/tests/_root/shared/config/lang.php b/tests/_root/shared/config/lang.php index 7f754a9..e39d913 100644 --- a/tests/_root/shared/config/lang.php +++ b/tests/_root/shared/config/lang.php @@ -6,8 +6,8 @@ * Multilingual settings * --------------------------------------------------------- */ - 'supported' => ['en', 'ru', 'am'], 'default' => 'file', + 'supported' => ['en', 'ru', 'am'], 'default_locale' => 'en', 'file' => [], 'url_segment' => 1,