Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic for setting the locale when using System Default #4570

Conversation

ChunkyProgrammer
Copy link
Member

Fix logic for setting the locale when using System Default

Pull Request Type

  • Bugfix

Related issue

closes #3360

Description

The comparison being done was incorrect and didn't check the country code.

Testing

Test 1 - en-US as system locale

  • set system locale to en-US
  • Log out and log back in to your computer if necessary (you may need to log out for the change to take effect)
  • Run FreeTube
  • Set locale to System Default
  • (notice that text remains System Default)

Test 2 - en-UK as system locale

  • set FreeTube locale to en-US
  • set system locale to en-UK
  • Log out and log back in to your computer if necessary (you may need to log out for the change to take effect)
  • Run FreeTube
  • Set locale to System Default
  • (notice that text becomes System default)

Desktop

  • OS: Linux Mint
  • OS Version: 21.3
  • FreeTube version: 0.19.1

Additional context

Bug was introduced in #2271

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) January 18, 2024 05:22
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jan 18, 2024
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid logging out to test this
I stub the result by adding return 'en-US' & return 'en-GB' before return app.getSystemLocale()

@@ -720,7 +720,8 @@ function runApp() {
})

ipcMain.handle(IpcChannels.GET_SYSTEM_LOCALE, () => {
return app.getLocale()
// we should switch to getPreferredSystemLanguages at some point and iterate through until we find a supported locale
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the non-electron fallback we can use navigator.languages instead of navigator.language.

@FreeTubeBot FreeTubeBot merged commit 1becb8e into FreeTubeApp:development Jan 19, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jan 19, 2024
@ChunkyProgrammer ChunkyProgrammer deleted the fix-system-locale-setting-logic branch January 30, 2024 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Language preference System default is showing incorrect language
5 participants