Skip to content

Allow to pass function for interpolation #3

Description

@ixrock

Let's imagine i18n.init() has the following resources:

    resources: {
      en: {
        default: {
          message: "Hello world <test>some text</test>!",
        }
      },
    },

I'd like to consume such translation string inside component as:

t("message", {
  test: text => <b>{text}</b>
})

And in the result we have something like it's written in JSX:

<>
 Hello world <b>some text</b>!
</>

The children within <test></test> could be any of type as inside normal react-component.
Possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions