nb-trans icon indicating copy to clipboard operation
nb-trans copied to clipboard

Can use the lodash's template() function to handle the translated string

Open bigBear713 opened this issue 11 months ago • 0 comments

version: v16.0.0 The lib support the template with params, like This is a {{param1}}, and the {{param1}} with be replaced as param value.

Now it is handled by RegExp, it is ok now, but it's a bit complicated. I think we can simplify the process, using a third-party lib to do it.

The lodash you know is a powful third-party lib, and provide template() to handle template string. I think we can try to use it to help us to handle the translated string, we only need to provide the translated string and params value. It can make the process be more simple.

Of course, it's not always the best way, so try it and discuss it

bigBear713 avatar Jul 12 '23 23:07 bigBear713