Skip to content

Commit b2f26ac

Browse files
committed
[#533] Update project Lang config for adapter support
1 parent ecfa220 commit b2f26ac

5 files changed

Lines changed: 55 additions & 8 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"type": "project",
2727
"require": {
2828
"php": "^8.0",
29-
"quantum/framework": "^3.0.3",
29+
"quantum/framework": "dev-master",
3030
"fakerphp/faker": "^1.15",
3131
"bluemmb/faker-picsum-photos-provider": "^2.0",
3232
"ottaviano/faker-gravatar": "^0.3.0",

helpers/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
function url_with_lang(string $lang): string
2222
{
2323
if (!in_array($lang, (array) config()->get('lang.supported'))) {
24-
$lang = config()->get('lang.default');
24+
$lang = config()->get('lang.default_locale');
2525
}
2626

2727
if (trim(route_uri()) == '/') {

shared/config/lang.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,35 @@
33
return [
44
/**
55
* ---------------------------------------------------------
6-
* Multilingual settings
6+
* Language configurations
77
* ---------------------------------------------------------
88
*/
9-
'enabled' => true,
9+
'default' => 'deepl',
1010
'supported' => ['en', 'es'],
11-
'default' => 'en',
11+
'default_locale' => 'en',
1212
'url_segment' => 1,
13+
'file' => [],
14+
'deepl' => [
15+
'use_source_catalog' => true,
16+
'auth_key' => '',
17+
'api_url' => '',
18+
'source_locale' => 'en',
19+
'cache' => [
20+
'enabled' => true,
21+
'default' => 'file',
22+
'ttl' => 3600,
23+
'prefix' => 'lang_deepl:',
24+
],
25+
],
26+
'google_translate' => [
27+
'use_source_catalog' => true,
28+
'api_key' => '',
29+
'source_locale' => 'en',
30+
'cache' => [
31+
'enabled' => true,
32+
'default' => 'file',
33+
'ttl' => 3600,
34+
'prefix' => 'lang_google_translate:',
35+
],
36+
],
1337
];

tests/_root/helpers/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
function url_with_lang(string $lang): string
77
{
88
if (!in_array($lang, (array) config()->get('lang.supported'))) {
9-
$lang = config()->get('lang.default');
9+
$lang = config()->get('lang.default_locale');
1010
}
1111

1212
if (trim(route_uri()) == '/') {

tests/_root/shared/config/lang.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,31 @@
66
* Multilingual settings
77
* ---------------------------------------------------------
88
*/
9-
'enabled' => true,
109
'supported' => ['en', 'ru', 'am'],
11-
'default' => 'en',
10+
'default' => 'file',
11+
'default_locale' => 'en',
12+
'file' => [],
1213
'url_segment' => 1,
14+
'deepl' => [
15+
'use_source_catalog' => true,
16+
'auth_key' => '',
17+
'source_locale' => 'en',
18+
'cache' => [
19+
'enabled' => true,
20+
'default' => 'file',
21+
'ttl' => 3600,
22+
'prefix' => 'lang_deepl:',
23+
],
24+
],
25+
'google_translate' => [
26+
'use_source_catalog' => true,
27+
'api_key' => '',
28+
'source_locale' => 'en',
29+
'cache' => [
30+
'enabled' => true,
31+
'default' => 'file',
32+
'ttl' => 3600,
33+
'prefix' => 'lang_google_translate:',
34+
],
35+
],
1336
];

0 commit comments

Comments
 (0)