martinkr/next-export-i18n

Support for defaultVariables

metronome12 opened this issue · 1 comments

Is there a way to specify defaultVariables in the configuration?

interpolation: {
defaultVariables: {price: 100, product_name:"The product"}
}

So that they will be substituted for all values in the language file list so:

{
"product": {
"title":"{{product_name}} is the best",
"description":"The {{product_name}} is know for efficiency."
}
}

t('title') would still work without providing product name

and not have to do this:

t('title', {product_name: "The Product"})

Hi @metronome12 ,

Thank you for reaching out.
Maybe using the build-in templating solution could solve your issue?

Let me know if this is helpful, if not I'll take a closer look and try to come up with a solution for your use-case.

Cheers