Azuracast: Language preference not working?

Created on 6 Sep 2020  Â·  5Comments  Â·  Source: AzuraCast/AzuraCast

Using Docker installation method
Yes

AzuraCast version
v0.10.3, #de74d50 (2020-09-05 22:00) Rolling • Docker • PHP 7.4

Host Operating System
Fresh Minimal CentOS 7 Install

Describe the bug
Changing the language to any other than English doesn't change the interface language.

To Reproduce

  1. Change Language to any other than English

Expected behavior
To see the new language.

Screenshots
image

Device(s):

  • Device: Macbook Pro
  • OS: MacOS 10.15 Catalina
  • Browser: Chrome 85.0.4183.83 (Official Build) (64-bit)

Tried with 2 different accounts (both Super Administrator) without success.

bug

All 5 comments

Can confirm this happening on my installation too.

Regardless of the browser I'm using (all are set to use German as language) when I set the language of my AzuraCast user to English it stays on the German language. When I change the preferred language of the browser to English AzuraCast switches to that language.

This looks like a bug that leads to the browsers preferred language overriding the AzuraCast users language setting when Use Browser Default is not set.

Found the issue 😃

The Customization Class is using the $this->user property to set the user locale in this line: https://github.com/AzuraCast/AzuraCast/blob/ffa6d6b4fc26499cfc531af34cc9270688bc856e/src/Customization.php#L89-L92

The problem is that $this->user is initialized after initLocale() is called here: https://github.com/AzuraCast/AzuraCast/blob/ffa6d6b4fc26499cfc531af34cc9270688bc856e/src/Customization.php#L37-L40

This issue was introduced in commit 6f66ff072b2217317dc43f6ddf2c4745f14bcc03

I've provided a PR to fix this issue.

I was going to - just looking how to contribute now and setting up my environment.

Maybe we can have a unit test written so we can avoid the regression?

https://github.com/AzuraCast/AzuraCast/tree/master/tests/unit

I've tried to add a Functional test that checks if the translation is correctly used but I'm having some issues on that front since the tests are always running with the default locale (see my comment in the PR).

Was this page helpful?
0 / 5 - 0 ratings