Skip to content

Fall back to English when the user's or host language isn't installed #501

Closed

Description

@caseysoftware

If host_locale or a user's LOCALE preference names a language that isn't installed:

  1. CAppUI::setUserLocale() calls findLanguage(), which returns null.
  2. $LANGUAGES[null] is read (warning), list(...) unpacks null, and user_locale becomes null.
  3. index.php includes locales//locales.php (warning), so LOCALE_FIRST_DAY is never defined.
  4. The calendar views (MonthCalendar, events/week_view.php, the day-name helper in cleanup_functions.php) stop with a fatal Error: Undefined constant "LOCALE_FIRST_DAY".

This is rare today but becomes common once languages are separate downloads.

Fix

  • setUserLocale(): when no language matches, fall back to en_US.
  • Replace the seven copies of include locales/<code>/locales.php + include locales/core.php (index.php ×4, calendar.php, fileviewer.php, modules/system/do_preference_aed.php) with one $AppUI->loadLocale() that checks file_exists() and falls back to en.

Test: set a user's preference to de_DE, rename locales/de, and open the calendar, week view, Gantt and Help as that user: English, no warnings.

Part of #495.

Activity

  1. added a commit that references this issue on Oct 24, 2026
    33747d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions