@propbinder/mobile-design 0.2.24 → 0.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2370,12 +2370,35 @@ class DsMobileProfileActionsSheetComponent {
2370
2370
  }
2371
2371
  }
2372
2372
  ngOnInit() {
2373
- // Fallback initialization if not already set by ngOnChanges
2374
- if (!this.selectedLanguage()) {
2373
+ // Try to get language from localStorage as fallback
2374
+ const storedLangCode = this.getLanguageFromStorage();
2375
+ if (storedLangCode) {
2376
+ this.selectedLanguage.set(storedLangCode);
2377
+ this.initialLanguage = storedLangCode;
2378
+ }
2379
+ else if (!this.selectedLanguage()) {
2380
+ // Fallback to input if storage is empty
2375
2381
  this.selectedLanguage.set(this.currentLanguage);
2376
2382
  this.initialLanguage = this.currentLanguage;
2377
2383
  }
2378
2384
  }
2385
+ /**
2386
+ * Try to resolve short language code from localStorage ('selectedLanguage' key)
2387
+ */
2388
+ getLanguageFromStorage() {
2389
+ try {
2390
+ const stored = localStorage.getItem('selectedLanguage'); // e.g. "da-DK", "sv-SE"
2391
+ if (!stored)
2392
+ return null;
2393
+ // Find the code from availableLanguages that matches this locale/string
2394
+ // We check if any language code is part of the stored string (e.g. 'da' in 'da-DK')
2395
+ const match = this.availableLanguages.find(lang => lang.code === stored || stored.startsWith(lang.code + '-'));
2396
+ return match ? match.code : null;
2397
+ }
2398
+ catch (e) {
2399
+ return null;
2400
+ }
2401
+ }
2379
2402
  /**
2380
2403
  * Handle action item click
2381
2404
  */