Closed bfontaine closed 1 year ago
Hi @bfontaine, if i understand you correctly, you want to iterate through defined translation keys and then update translation records in case of missing entry? If so, i would do something like this:
1) First of all, i would iterate your translation keys using $t('<CURRENT_KEY>', { default: 'undefined' })
(or t.get( ... )
) and collect all keys for 'undefined'
(default) value.
2) I would update translations for undefined keys either in your definition files or locally using addTranslations
method.
Let me, please, know if it helped to you..
Hello, to clarify, I want a tool/command that I can run to statically extract all calls to $t(...)
from my code and add the missing keys in the translation files.
The workflow would look like this:
$t("...")
where needednpm run extract-translations
Oh, Ok. Currently, there are no CLI tools to extract used translations..
Ok, thank you for the response!
Hello, Is there any way to parse the code and extract the missing translations for a locale? I’m looking for a gettext-like workflow where I just use
$t('whatever')
in my code and then run a command to update the translation files with the new keys. I didn’t find anything in the docs for that. Thanks