-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto scan for translation strings #58
Comments
An example of how I'm using
I am not however using any |
To make for a cleaner commit history, I deleted the |
I'm seeing that the
These issues may explain some of the oddities of how the |
Well I seem to have made some progress: I created a separate |
However I'm still not able to make the |
Perhaps this is just because I'm still not that familiar with Weblate, but can you help me understand what problem we're trying to solve here?
|
Ah, I just noticed we broke stuff here #57 I should have noticed in review that we were adding strings without adding them to |
That's exactly why I've been looking into |
Rather than add them manually, I would continue looking into |
Weblate will take care of adding missing keys to translation files, if they are present in the source file ( What this solves, is keys that are missing from Say for example you change a component, or decide to handle a certain string differently and wind up changing it's key, or splitting it into multiple translation strings each with their own key, or simply add a new component with it's own translation strings and new keys... Whatever is the case, you will always be sure to have the exact needed keys in the source translation file |
fixed in PR #60 |
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 aPR
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:i18n
initialization (transSupportBasicHtmlNodes
andtransKeepBasicHtmlNodesFor
) to no availcomponents
parameter within theTrans
component to no availi18next-scanner
is supposed to be able to play nicely withTrans
components, but I haven't been having much luck as of yetWhile 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
The text was updated successfully, but these errors were encountered: