Skip to content

Fix follow-system app language to use primary locale#13546

Closed
wizdom13 wants to merge 1 commit into
TeamNewPipe:devfrom
wizdom13:fix-mixed-language-ui-issue
Closed

Fix follow-system app language to use primary locale#13546
wizdom13 wants to merge 1 commit into
TeamNewPipe:devfrom
wizdom13:fix-mixed-language-ui-issue

Conversation

@wizdom13
Copy link
Copy Markdown

@wizdom13 wizdom13 commented May 25, 2026

What is it?

  • Bugfix (user facing)
  • Feature (user facing) ⚠️ Your PR must target the refactor branch
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

Fixes inconsistent/mixed UI language behavior when Android has multiple system languages configured and NewPipe is set to use the default/system app language.

The issue was reported in #13107. For example, when Android system languages are configured as:

  1. English (US)
  2. Japanese

some NewPipe UI strings could appear in Japanese even though the primary system language is English.

This PR fixes the locale handling so that NewPipe uses the intended primary/default app locale consistently instead of mixing strings from a secondary system language.

Changed area:

  • app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java

What is actually fixed?

Before this change, NewPipe could show UI strings from multiple languages when the app language was set to default/follow system and Android had more than one system language configured.

After this change, NewPipe consistently uses the expected app/system UI language. If English (US) is the primary Android language and Japanese is secondary, NewPipe UI remains in English instead of randomly mixing English and Japanese strings.

Fixes the following issue(s)

Fixes #13107

APK testing

Tested manually with the following language configurations:

  • English (US) primary, Japanese secondary
  • English (US) primary, English (UK) secondary, Japanese third
  • Japanese primary, English (US) secondary

Checked:

  • NewPipe starts without mixed UI strings.
  • App language set to default/follow system works correctly.
  • Explicit app language selection still works.
  • Restarting the app keeps the expected language behavior.

Before/After Screenshots/Screen Record

Before:

  • UI could show mixed English/Japanese strings when Android had multiple system languages.

After:

  • UI consistently follows the selected/default app language.

Due diligence

@github-actions github-actions Bot added the size/small PRs with less than 50 changed lines label May 25, 2026
@TobiGr TobiGr added the template ignored The user didn't follow the template/instructions (or removed them) label May 25, 2026
@TobiGr
Copy link
Copy Markdown
Contributor

TobiGr commented May 25, 2026

Please fill in the template and exlain what is actually fixed.

@wizdom13
Copy link
Copy Markdown
Author

Please fill in the template and exlain what is actually fixed.

Thanks, I updated the PR description and filled in the template. I also added a clearer explanation of what was fixed and linked it to #13107.

@TobiGr TobiGr added bug Issue is related to a bug localisation/translation Everything that has to do with translations or Weblate and removed template ignored The user didn't follow the template/instructions (or removed them) labels May 25, 2026
Comment on lines +66 to 73
final String tag;
if (systemLang.equals(language)) {
final Locale systemLocale = LocaleListCompat.getAdjustedDefault().get(0);
tag = (systemLocale == null ? Locale.getDefault() : systemLocale).toLanguageTag();
} else {
tag = language;
}
AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(tag));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
final String tag;
if (systemLang.equals(language)) {
final Locale systemLocale = LocaleListCompat.getAdjustedDefault().get(0);
tag = (systemLocale == null ? Locale.getDefault() : systemLocale).toLanguageTag();
} else {
tag = language;
}
AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(tag));
if (systemLang.equals(language)) {
AppCompatDelegate.setApplicationLocales(LocaleListCompat.getAdjustedDefault());
} else {
AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(language));
}

@wizdom13 wizdom13 closed this May 30, 2026
@wizdom13 wizdom13 deleted the fix-mixed-language-ui-issue branch May 30, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is related to a bug localisation/translation Everything that has to do with translations or Weblate size/small PRs with less than 50 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI Elements showing in mixed languages

3 participants