Skip to content

Commit

Permalink
Fixed #3063
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jul 4, 2018
1 parent 02c7166 commit 4c9cc23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft CMS 3.x

## Unreleased

### Fixed
- Fixed a bug where `craft\i18n\I18N::getPrimarySiteLocale()` and `getPrimarySiteLocaleId()` were returning locale info for the _first_ site, rather than the primary one. ([#3063](https://github.com/craftcms/cms/issues/3063))

## 3.0.14 - 2018-07-03

### Changed
Expand Down
7 changes: 3 additions & 4 deletions src/i18n/I18N.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,8 @@ public function getSiteLocales(): array
*/
public function getPrimarySiteLocale(): Locale
{
$locales = $this->getSiteLocales();

return $locales[0];
$site = Craft::$app->getSites()->getPrimarySite();
return new Locale($site->language);
}

/**
Expand All @@ -239,7 +238,7 @@ public function getPrimarySiteLocale(): Locale
*/
public function getPrimarySiteLocaleId(): string
{
return $this->getPrimarySiteLocale()->id;
return Craft::$app->getSites()->getPrimarySite()->language;
}

/**
Expand Down

0 comments on commit 4c9cc23

Please sign in to comment.