Description
Rather than manually adding translation strings to the public/locales/en/translation.json
file, and trying to keep other language files in sync with the English language file, a simple scanner could be implemented and triggered either when committing/pushing or when a PR
is issued.
For example, https://github.com/i18next/i18next-scanner .
I've run a few tests locally, but I'm running into a couple issues which I haven't succeeded in overcoming yet:
-
The tags within
<Trans>
components (such as<p>
,<b>
,<i>
,<strong>
, etc.) are being substituted with indexed tags, even though I setsupportBasicHtmlNodes
totrue
andkeepBasicHtmlNodesFor
to['br', 'strong', 'i', 'p', 'b', 'vatican', 'github']
. I have tried a few things such as:- setting similar options in
i18n
initialization (transSupportBasicHtmlNodes
andtransKeepBasicHtmlNodesFor
) to no avail - setting the
components
parameter within theTrans
component to no avail
i18next-scanner
is supposed to be able to play nicely withTrans
components, but I haven't been having much luck as of yet - setting similar options in
-
While the configuration option
defaultValue
works fine fort()
functions, however forTrans
components the string value in English is being set in all language files, whether English or not. Instead it would be desirable for an empty value to be set in non English language files, while the source string is correctly set in the English language file. This perhaps needs to be handled within thecustomTransform
function?
I have created a new branch to track progress on this: feature/i18n-scanner