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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options passed in replace object can't be used as count for nested translation #1896

Closed
AlexKrupko opened this issue Jan 2, 2023 · 6 comments

Comments

@AlexKrupko
Copy link

馃悰 Bug Report

Options passed in replace object can't be used as count value for nested translation. It select proper translation correctly, but doesn't pass count value.
Please check a console output in codesandbox example.

To Reproduce

A codesandbox example.

Your Environment

  • i18next version: i.e. 21.x, 22.x
@adrai
Copy link
Member

adrai commented Jan 2, 2023

  1. You need to correctly specify interpolated variable in dot notation
  2. it seems the replace variable name conflicts, so just use a different variable name: https://codesandbox.io/s/intelligent-mirzakhani-lyd6cc

@adrai
Copy link
Member

adrai commented Jan 2, 2023

fyi: v22.4.7 should now also fix the replace variable name

@adrai adrai closed this as completed Jan 2, 2023
@AlexKrupko
Copy link
Author

@adrai ,
it seems replace values are not extracted anymore and we have to use always replace. prefix in interpolations - Codesandbox

@adrai
Copy link
Member

adrai commented Jan 2, 2023

Yes, that's correct... the replace option was only for the old v1 version... where did you find the information about this old replace option functionality?

@AlexKrupko
Copy link
Author

I guess, I saw it somewhere in docs. I use i18next starting with 18 version, probably it was there before.
Also TS declaration contains this and my IDEA always proposes this option

export interface TOptionsBase {
  ....
  /**
   * Object with vars for interpolation - or put them directly in options
   */
  replace?: any;
  ....
}

@adrai
Copy link
Member

adrai commented Jan 3, 2023

I see....

v22.4.8 should fix it

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

No branches or pull requests

2 participants