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..b013b45 100644 --- a/shared/config/lang.php +++ b/shared/config/lang.php @@ -3,11 +3,34 @@ return [ /** * --------------------------------------------------------- - * Multilingual settings + * Language configurations * --------------------------------------------------------- */ - 'enabled' => true, + 'default' => 'file', 'supported' => ['en', 'es'], - 'default' => 'en', + 'default_locale' => 'en', 'url_segment' => 1, + 'file' => [], + '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:', + ], + ], ]; 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..e39d913 100644 --- a/tests/_root/shared/config/lang.php +++ b/tests/_root/shared/config/lang.php @@ -6,8 +6,31 @@ * Multilingual settings * --------------------------------------------------------- */ - 'enabled' => true, + 'default' => 'file', 'supported' => ['en', 'ru', 'am'], - 'default' => 'en', + '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:', + ], + ], ];