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

useTranslations hook #21

Merged
merged 2 commits into from
Aug 9, 2024
Merged

useTranslations hook #21

merged 2 commits into from
Aug 9, 2024

Conversation

vuolen
Copy link
Member

@vuolen vuolen commented Aug 7, 2024

Added a hook for using translations and made small changes to LanguageProvider

  • Renamed LocalizationContext.tsx file to match its contents
  • Small tweaks to fetching the translations
  • Made LanguageContext fail if language is not provided
    • I think its better for this to be quite strict just so that a missing language provider doesnt mess things up, idk though
  • added useTranslate
    • I think we could just start using "translation" as a name for a piece of text with all three languages
    • This means changing the CMS data schema as well
    • You can check out the test file on examples how to use it, its also typed correctly which is nice

@vuolen vuolen force-pushed the translations-hook branch from 824c3a9 to ef09c79 Compare August 9, 2024 14:09
Copy link

github-actions bot commented Aug 9, 2024

Visit the preview URL for this PR (updated for commit 7f45d43):

https://satakuntalainenosakunta--pr21-translations-hook-rj75k96i.web.app

(expires Fri, 16 Aug 2024 14:34:02 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 1ec35f964edce5d08911a93688b4dc7a051b997f

vuolen added 2 commits August 9, 2024 17:29
…eProvider

- Renamed LocalizationContext.tsx file to match its contents
- Small tweaks to fetching the translations
- Made LanguageContext fail if language is not provided
  - I think its better for this to be quite strict just so that a missing language provider doesnt mess things up, idk though
- added useTranslate
  - I think we could just start using "translation" as a name for a piece of text with all three languages
  - This means changing the CMS data schema as well
  - You can check out the test file on examples how to use it, its also typed correctly which is nice
@vuolen vuolen force-pushed the translations-hook branch from ef09c79 to 7f45d43 Compare August 9, 2024 14:32
@vuolen vuolen merged commit 312faf7 into main Aug 9, 2024
2 checks passed
@vuolen vuolen deleted the translations-hook branch August 9, 2024 14:35
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.

1 participant