Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"type": "project",
"require": {
"quantum/framework": "^2.9.8",
"quantum/framework": "dev-master",
"fakerphp/faker": "^1.15",
"bluemmb/faker-picsum-photos-provider": "^2.0",
"doctrine/annotations": "^2.0",
Expand Down
6 changes: 3 additions & 3 deletions helpers/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
*/
function url_with_lang(string $lang): string
{
if (!in_array($lang, (array)config()->get('langs'))) {
$lang = config()->get('lang_default');
if (!in_array($lang, (array)config()->get('lang.supported'))) {
$lang = config()->get('lang.default');
}

if (trim(route_uri()) == '/') {
Expand All @@ -40,7 +40,7 @@ function url_with_lang(string $lang): string

$url = base_url(true);

$langSegmentIndex = config()->get('lang_segment');
$langSegmentIndex = config()->get('lang.url_segment');

$uri = '';

Expand Down
12 changes: 0 additions & 12 deletions shared/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@
*/
'app_key' => env('APP_KEY'),

/**
* ---------------------------------------------------------
* Language
* ---------------------------------------------------------
*
* Possible languages and project default language.
*/
'multilang' => true,
'langs' => ['en', 'ru', 'am'],
'lang_default' => 'en',
'lang_segment' => 1,

/**
* ---------------------------------------------------------
* Error handling
Expand Down
13 changes: 13 additions & 0 deletions shared/config/lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
/**
* ---------------------------------------------------------
* Multilingual settings
* ---------------------------------------------------------
*/
'enabled' => true,
'supported' => ['en', 'ru', 'am'],
'default' => 'en',
'url_segment' => 1,
];
2 changes: 0 additions & 2 deletions tests/Feature/modules/Api/AuthControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ public function testModuleApiResendEndpointWithIncorrectOtpToken()
$this->assertError($response, 'Incorrect credentials');
}



protected function assertSuccess($response, string $message = null): void
{
$this->assertEquals('success', $response->get('status'));
Expand Down
8 changes: 4 additions & 4 deletions tests/_root/helpers/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
*/
function url_with_lang(string $lang): string
{
if (!in_array($lang, (array)config()->get('langs'))) {
$lang = config()->get('lang_default');
if (!in_array($lang, (array)config()->get('lang.supported'))) {
$lang = config()->get('lang.default');
}

if (trim(route_uri()) == '/') {
Expand All @@ -40,7 +40,7 @@ function url_with_lang(string $lang): string

$url = base_url(true);

$langSegmentIndex = config()->get('lang_segment');
$langSegmentIndex = config()->get('lang.url_segment');

$uri = '';

Expand All @@ -57,7 +57,7 @@ function url_with_lang(string $lang): string
$url .= '/' . ($index == $langSegmentIndex ? $lang : $segment);
}
}

dd($url);
return $url;
}

Expand Down
4 changes: 0 additions & 4 deletions tests/_root/shared/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
return [
'app_key' => env('APP_KEY'),
'app_email' => 'app@quantumphp.io',
'multilang' => true,
'langs' => ['en', 'es', 'fr'],
'lang_default' => 'en',
'lang_segment' => 1,
'debug' => true,
'test' => 'Testing',
'otp_expires' => 2,
Expand Down
13 changes: 13 additions & 0 deletions tests/_root/shared/config/lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
/**
* ---------------------------------------------------------
* Multilingual settings
* ---------------------------------------------------------
*/
'enabled' => true,
'supported' => ['en', 'ru', 'am'],
'default' => 'en',
'url_segment' => 1,
];