react-i18next icon indicating copy to clipboard operation
react-i18next copied to clipboard

Type-safe translations do not work with context

Open stefan-schweiger opened this issue 3 years ago • 2 comments

🐛 Bug Report

Similar to https://github.com/i18next/react-i18next/issues/1386 having a context does not work with typesafety:

To Reproduce

{
  "key_optionA": "My Option A",
  "key_optionB": "My Option B",
}

t('key', {context: "optionA"}); // TS error, only key_optionA or key_optionB are allowed
t('key', {context: "optionB"}); // TS error

Expected behavior

Such resources should be allowed to be used without the suffix.

Your Environment

stefan-schweiger avatar Aug 08 '22 15:08 stefan-schweiger

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 20 '22 19:09 stale[bot]

Not stale

stefan-schweiger avatar Sep 20 '22 19:09 stefan-schweiger

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 01 '22 00:10 stale[bot]

not stale

stefan-schweiger avatar Oct 01 '22 09:10 stefan-schweiger

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 12 '22 09:10 stale[bot]

not stale...

stefan-schweiger avatar Oct 13 '22 09:10 stefan-schweiger

@pedrodurek is there a chance this is going to work with your new TypeScript rewrite? btw: any ETA?

adrai avatar Oct 14 '22 07:10 adrai

@adrai @pedrodurek any chance of removing the stale tag permanently so I don't have to post a comment every week? 😄

stefan-schweiger avatar Oct 14 '22 08:10 stefan-schweiger

i18next v22.4.5 might be better

adrai avatar Dec 13 '22 10:12 adrai

I faced the same problem

i18next: 22.4.11 react-i18next: 12.2.0

lamo2k123 avatar Mar 14 '23 18:03 lamo2k123

https://github.com/i18next/react-i18next/issues/1617

adrai avatar Jun 13 '23 06:06 adrai

i18next v23.0.0 will probably not address that yet

adrai avatar Jun 15 '23 06:06 adrai

i18next v23.2.11 has still not addressed.

getting error when using context

ngima avatar Jul 26 '23 13:07 ngima

handled in i18next v23.4.0 (https://github.com/i18next/i18next/pull/2007/files#diff-97e65d0ee521805ff4ac2d967b61062da8f5543569da4177ceeff689ce4463a3R150)

adrai avatar Jul 29 '23 06:07 adrai