Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add typeScript support to enforce valid translation keys #1954

Merged
merged 6 commits into from
Jul 15, 2023
Merged

feat: add typeScript support to enforce valid translation keys #1954

merged 6 commits into from
Jul 15, 2023

Conversation

Ajaykumbhare
Copy link
Contributor

@Ajaykumbhare Ajaykumbhare commented Jul 14, 2023

To prevent issues like #1952, I have introduced TypeScript support to enforce the usage of valid translation keys.

  • Added TypeScript support to enforce valid translation keys when using the useTranslate hook.
  • Modified the type definitions of the useTranslate hook to restrict the allowed translation keys to those available in the en.json file.
  • This enhancement ensures that developers are alerted to any invalid translation keys at compile-time, reducing the possibility of runtime errors related to missing or mistyped keys.
  • By enforcing valid translation keys, we improve the maintainability and reliability of the localization system.

@Ajaykumbhare Ajaykumbhare requested a review from boojack as a code owner July 14, 2023 14:14
@github-actions
Copy link

github-actions bot commented Jul 14, 2023

Uffizzi Preview deployment-30941 was deleted.

@boojack boojack requested a review from CorrectRoadH July 14, 2023 16:13
Copy link
Collaborator

@boojack boojack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great refactor!

@boojack boojack merged commit 1780225 into usememos:main Jul 15, 2023
lincolnthalles pushed a commit to lincolnthalles/memos that referenced this pull request Oct 21, 2023
…mos#1954)

* usememos#1952 Fix incorrect localization key for sign-up failure message

* feat: add typeScript support to enforce valid translation keys

* feat: add typeScript support to enforce valid translation keys

* fix lint errors

* fix lint error
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.

2 participants