Skip to content

Conversation

wintondeshong
Copy link
Contributor

Hook to leverage translations in modern react functional components in a typed fashion.

// culture-resources.ts
interface CultureResources {
    myKey: string;
}

// my-component.ts
const { t } = useLocalization<CultureResources>();

return <p>{t("myKey")}</p>; // <----------- statically ensures 'myKey' exists

@wintondeshong wintondeshong added the enhancement New feature or request label Jun 26, 2020
@codecov
Copy link

codecov bot commented Jun 26, 2020

Codecov Report

Merging #12 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #12   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         9    +1     
  Lines          158       166    +8     
  Branches        18        18           
=========================================
+ Hits           158       166    +8     
Impacted Files Coverage Δ
src/hooks/use-localization.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b5f87d...20cbb19. Read the comment docs.

@wintondeshong wintondeshong marked this pull request as ready for review June 26, 2020 18:51
@wintondeshong wintondeshong merged commit d477a7a into rsm-hcd:master Jun 30, 2020
@brandongregoryscott
Copy link
Contributor

@all-contributors add @wintondeshong for code, doc, test

@allcontributors
Copy link
Contributor

@brandongregoryscott

I've put up a pull request to add @wintondeshong! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants