SUI-Components/sui

[Sui-i18n] Interpolate nested chunks generate noisy warnings

mariofpalb opened this issue · 0 comments

Package

sui-i18n@1.32.0

Description

We have noticed something while developing with i18n that the interpolate function has an issue when nesting chunks like this:

%[key]%[key2]children[key2]%[key]%

The thing is that if you pass to the values object both keys definitions, is it going to work as expected. However, is not because of the nested interpolate function: https://github.com/SUI-Components/sui/blob/master/packages/sui-i18n/src/i18n.js#L218-L221

This method arguments expects another literal key, when in the example shown before the children value is %[key2]children[key2]%. This ends up showing a lot of warnings in the console that at the end makes it very noisy.

Steps to Reproduce

  1. Set a literal like the example before, with a nested chunk inside another one.
  2. Set the literal key inside the interpolate function and set values for both keys (key and key2 in the example before)
  3. Go to the page where this literals are interpolated and see the console of the navigator

Expected behavior: There is no warnings in the console when interpolating this nested literals.

Actual behavior: There is a lot of noisy warnings in the console whenever a nested chunk occures.

Reproduces how often: I would say this happens very rarely

Additional Information

I would say more testing in this feature could check this behaviour better.