Skip to content

fix(i18n): persist selected locale to localStorage and restore on init - #1299

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Abdulrasaq1515:fix/persist-locale-to-localStorage
Aug 30, 2026
Merged

fix(i18n): persist selected locale to localStorage and restore on init#1299
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Abdulrasaq1515:fix/persist-locale-to-localStorage

Conversation

@Abdulrasaq1515

Copy link
Copy Markdown
Contributor

Persist the selected language to localStorage via a shared storage key constant and restore it on provider mount. Adds validation against supported languages so corrupted or invalid stored values fall back to the default locale. Wraps localStorage writes in try-catch for resilience in private browsing modes. Also reuses isRTLUtil for html dir consistency.

Added comprehensive unit tests covering persistence, restoration, validation, re-mount (reload simulation), document/cookie updates, and fallback behaviour outside the provider.

closes #1294

Description

Brief description of changes

Related Issue

Closes #

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • Uses Lucide icons consistently
  • Responsive design implemented
  • Starknet best practices followed

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@Abdulrasaq1515 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Persist the selected language to localStorage via a shared storage key
constant and restore it on provider mount. Adds validation against
supported languages so corrupted or invalid stored values fall back to
the default locale. Wraps localStorage writes in try-catch for
resilience in private browsing modes. Also reuses isRTLUtil for
html dir consistency.

Added comprehensive unit tests covering persistence, restoration,
validation, re-mount (reload simulation), document/cookie updates,
and fallback behaviour outside the provider.

closes rinafcode#1294
@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 3bae32a into rinafcode:main Aug 30, 2026
6 checks passed
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.

Persist the selected locale to localStorage

2 participants