Using the copy-webpack-plugin, I add [contenthash] to my i18next translation files in the name when building code.
{
from: 'public/locales/',
to: 'locales/[path][name].[contenthash][ext]',
},
At the output I get a file with that name translation. [contenthash] .json
and of course, when I try to execute the code on the server, I get an error because i18next is looking for files named translation.json.
The question is, can I somehow get [contenthash] in the backendOptions in i18next in the loadPath property?
I know that loadPath can also be a function, but unfortunately only lang and path come there, and I can't generate a hash myself.
CodePudding user response:
Using the i18next-http-backend the loadPath option can also be a function. This way you could construct your custom path: https://github.com/i18next/i18next-http-backend/issues/86