Skip to content

region: support systems without locale1 or AccountsService - #2318

Open
lumarogit wants to merge 1 commit into
pop-os:masterfrom
lumarogit:master
Open

lumarogit wants to merge 1 commit into
pop-os:masterfrom
lumarogit:master

Conversation

@lumarogit

Copy link
Copy Markdown

With no systemd, so the locale1 and AccountsService D-Bus services are missing. The region page failed to reload and neither the system locale nor the user language could be saved. The list of available locales was also almost empty, because only a few locales are generated.

Reading:

  • page_reload no longer aborts when the system D-Bus, the locale1 proxy, or its locale() call fails. It falls back to /etc/locale.conf, /etc/default/locale, ~/.config/locale.conf, ~/.config/environment.d/90-locale.conf, and finally the LANG/LC_* environment variables. Earlier sources win and each variable is only added once.

Writing:

  • set_locale tries locale1 SetLocale first. If that fails, it writes /etc/locale.conf via sudo or doas (keeping the export prefix that /etc/profile.d/locale.sh expects), then ~/.config/locale.conf. If nothing can be persisted, it logs a warning.
  • set_user_language tries AccountsService first. If that fails, it writes LANGUAGE=... to ~/.config/environment.d/90-locale.conf.
  • The fallback file writes use tokio instead of blocking std calls.

Available locales:

  • Besides locale -a, also list every definition found in /usr/share/i18n/locales as a UTF-8 locale.
  • Normalize all entries to the .utf8 suffix and deduplicate them in a BTreeSet, so the list is sorted and has no repeats.

PS: This fix is ​​already working correctly on starkOS GNU/Linux.

Please evaluate this proposal and make corrections if necessary; the main objective is to ensure that locales function properly on non-systemd systems.

Thanks, Luis.


  • I have not included any LLM (also known as AI) generated content in this PR, including code, comments, and descriptions.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.
  • I have read and followed all of the above requirements. For more information, see our contributor guide.

With no systemd, so the locale1 and AccountsService D-Bus services
are missing. The region page failed to reload and neither the system
locale nor the user language could be saved. The list of available
locales was also almost empty, because only a few locales are generated.

Reading:
- page_reload no longer aborts when the system D-Bus, the locale1
  proxy, or its locale() call fails. It falls back to
  /etc/locale.conf, /etc/default/locale, ~/.config/locale.conf,
  ~/.config/environment.d/90-locale.conf, and finally the LANG/LC_*
  environment variables. Earlier sources win and each variable is
  only added once.

Writing:
- set_locale tries locale1 SetLocale first. If that fails, it writes
  /etc/locale.conf via sudo or doas (keeping the `export` prefix that
  /etc/profile.d/locale.sh expects), then ~/.config/locale.conf. If
  nothing can be persisted, it logs a warning.
- set_user_language tries AccountsService first. If that fails, it
  writes LANGUAGE=... to ~/.config/environment.d/90-locale.conf.
- The fallback file writes use tokio instead of blocking std calls.

Available locales:
- Besides `locale -a`, also list every definition found in
  /usr/share/i18n/locales as a UTF-8 locale.
- Normalize all entries to the `.utf8` suffix and deduplicate them in
  a BTreeSet, so the list is sorted and has no repeats.
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.

1 participant