transloco-keys-manager
transloco-keys-manager copied to clipboard
Delete missing keys
I picked up the work from #51 and finished it. You'll find the original commit with minor changes (rebase) and my fixes on top.
Would love to have this merged! :)
This feature is really much needed. Hope you can finish it.
I'm waiting for it too. It is really important feature
@MickL Would you like to push this forward? If not, @IrinaZinevich @shprink you are more then welcome to pick this up :)
@rhuitl Can you please update this branch with latest master branch?
On it as we speak :)
Please check the latest version. I made the method immutable and added tests. I think I found a bug in the POT support with unflat = true
. It seems to not properly unflat when reading the file. This is why one test fails (it passes for JSON). Even without delete-missing-keys
, the POT file written out after reading it back in is wrong:
First write
msgid ""
msgstr ""
"mime-version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "1"
msgstr "missing"
msgid "2"
msgstr "missing"
msgid "group1.1"
msgstr "missing"
msgid "group1.2"
msgstr "missing"
msgid "group2.1"
msgstr "missing"
msgid "group2.2"
msgstr "missing"
Reading it back and writing it out again:
msgid ""
msgstr ""
"mime-version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "1"
msgstr "missing"
msgid "2"
msgstr "missing"
msgid "group1.2"
msgstr "missing"
msgid "group3.2"
msgstr "missing"
msgid "group1"
msgstr "[object Object]"
msgid "group2"
msgstr "[object Object]"
Do you have an idea what's going on?
@rhuitl I ran the tests locally on master and they seem to pass. not sure what's causing your issue
@rhuitl I ran the tests locally on master and they seem to pass. not sure what's causing your issue
I think that's because none of the existing tests reads back the translation files and updates them.
I think that's because none of the existing tests reads back the translation files and updates them.
- So that means that this is directly related to your test, debug it and figure out why this is failing for POT.
- I don't think that's related since before each spec you remove the i18n folder.
@rhuitl Are we logging which keys have been removed? Do you think we should?
@rhuitl Are we logging which keys have been removed? Do you think we should?
No we don't. I don't think we need to because people will have their translation files in version control, I suppose, so it's easy to review the changes and the messages would clutter up the output. Or do we log information about keys that are added or missing elsewhere already?
Regarding the gettext files, the test now passes. There was a flatten
step missing when writing out the POT file.
Further, I included a fix for a small typo.
Hey hey, is there anything left to do in this PR? Can you approve the workflow so we can see if the build and tests pass? Thank you!
@rhuitl Not sure why it won't let me 🤔
I see, I just amended the last commit. Let's see if it will run the workflows now. Maybe you get the option to approve it now.
Does it let you merge it now?
I added the tests for unflat = false
and made the naming changes you suggested.
@rhuitl Thank you for this PR!
can't wait to try that! thanks a lot everyone!