Skip to content

Commit

Permalink
remove get language
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Apr 21, 2021
1 parent c660dec commit 339d00f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion core/console/commands/ThemeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private function renderLayout($themeName)
$this->beginPage();
?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->composition->language; ?>">
<html lang="<?= Yii::$app->composition->langShortCode; ?>">
<head>
<title><?= $this->title; ?></title>
<meta charset="utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/app-module-urlrules.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ In order to define the url rules from the urlManager config scope, you can just

> When composition is enabled, it will take the correct route for the current language and prefix the pattern if enable in composition config.
To verify which composition language is used you can dump `Yii::$app->composition->language`. The {{luya\web\Composition}} component is taking care of LUYA multi language websites and is registered by default for all LUYA projects.
To verify which composition language is used you can dump `Yii::$app->composition->langShortCode`. The {{luya\web\Composition}} component is taking care of LUYA multi language websites and is registered by default for all LUYA projects.

## Application Controller Routes

Expand Down
11 changes: 0 additions & 11 deletions tests/core/web/CompositionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
* removed tests to implemented here (if not already).
*
*
$parts = Yii::$app->composition->get();
$this->assertArrayHasKey('langShortCode', $parts);
$this->assertArrayHasKey('foo', $parts);
$this->assertArrayHasKey('bar', $parts);
$this->assertEquals('de', $parts['langShortCode']);
$this->assertEquals('de', Yii::$app->composition->getLanguage());
$this->assertEquals('1234', $parts['foo']);
$this->assertEquals('luya09', $parts['bar']);
*
* @author nadar
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/core/web/UrlManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function testCompositionRuleWithHiddenLanguageButCompositionLangShortCode
$request = new Request();
$request->pathInfo = 'mentions-legales';
$composition = new Composition($request, ['hidden' => true, 'default' => ['langShortCode' => 'fr']]);
$this->assertSame('fr', $composition->language);
$this->assertSame('fr', $composition->langShortCode);
$urlManager = new UrlManager();
$urlManager->composition = $composition;
$urlManager->addRules([
Expand Down

0 comments on commit 339d00f

Please sign in to comment.