Fix: generic locale fallback on all platforms when language is unavai… #160

Closed
opened 2026-04-05 16:18:43 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @icedrone on 3/25/2026

Description

When the system locale is set to a regional variant that isn't installed on the OS (e.g. en_IL), OrcaSlicer crashes on startup on macOS and Windows with:

"Switching Orca Slicer to language en_IL failed"

The app then calls std::exit(EXIT_FAILURE) with no recovery.

Root cause: The locale fallback logic that tries alternative locales when wxLocale::IsAvailable() fails was only compiled for Linux (#ifdef __linux__). On macOS and Windows, there was no fallback — the code went straight to error and exit.

Fix:

  1. Try base language — strip the region code and try the base language (e.g. en_IL -> en). This is generic and works for any xx_YY locale.
  2. Generic fallback chain — if base language also fails, try: current locale, system language, best translation, en_US, en_UK. This logic already existed for Linux — it is now moved to apply on all platforms.
  3. The Linux-specific linux_get_existing_locale_language() call (which uses locale -a) remains Linux-only.

No breaking changes. No new dependencies.

Screenshots/Recordings/Graphs

Screenshot 2026-03-25 at 18 35 06

Environment

  • OrcaSlicer version: 2.3.2
  • macOS version: 15.7.4 (Build 24G517)

Tests

  • Set "language" in OrcaSlicer config to an unavailable regional locale (e.g. en_IL) — app should start with the base language (English) instead of crashing.
  • Set "language": "en_US" — should work normally, no change in behavior.
  • Set a valid non-English locale (e.g. de_DE) — should still load German correctly.
  • Verified the fallback chain does not overlap or conflict with existing Linux-specific fallback logic.
*Originally created by @icedrone on 3/25/2026* # Description When the system locale is set to a regional variant that isn't installed on the OS (e.g. `en_IL`), OrcaSlicer crashes on startup on macOS and Windows with: > "Switching Orca Slicer to language en_IL failed" The app then calls `std::exit(EXIT_FAILURE)` with no recovery. **Root cause:** The locale fallback logic that tries alternative locales when `wxLocale::IsAvailable()` fails was only compiled for Linux (`#ifdef __linux__`). On macOS and Windows, there was no fallback — the code went straight to error and exit. **Fix:** 1. **Try base language** — strip the region code and try the base language (e.g. `en_IL` -> `en`). This is generic and works for any `xx_YY` locale. 2. **Generic fallback chain** — if base language also fails, try: current locale, system language, best translation, `en_US`, `en_UK`. This logic already existed for Linux — it is now moved to apply on all platforms. 3. The Linux-specific `linux_get_existing_locale_language()` call (which uses `locale -a`) remains Linux-only. No breaking changes. No new dependencies. # Screenshots/Recordings/Graphs <img width="260" height="227" alt="Screenshot 2026-03-25 at 18 35 06" src="https://github.com/user-attachments/assets/0527991a-7b91-47e7-a88e-5ac9ac9bd8ab" /> ## Environment - **OrcaSlicer version:** 2.3.2 - **macOS version:** 15.7.4 (Build 24G517) ## Tests - Set `"language"` in OrcaSlicer config to an unavailable regional locale (e.g. `en_IL`) — app should start with the base language (English) instead of crashing. - Set `"language": "en_US"` — should work normally, no change in behavior. - Set a valid non-English locale (e.g. `de_DE`) — should still load German correctly. - Verified the fallback chain does not overlap or conflict with existing Linux-specific fallback logic.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#160