transloco-keys-manager icon indicating copy to clipboard operation
transloco-keys-manager copied to clipboard

Delete missing keys

Open rhuitl opened this issue 3 years ago • 1 comments

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.

rhuitl avatar Apr 08 '21 10:04 rhuitl

Would love to have this merged! :)

MickL avatar May 11 '21 17:05 MickL

This feature is really much needed. Hope you can finish it.

shprink avatar Nov 03 '22 13:11 shprink

I'm waiting for it too. It is really important feature

IrinaZinevich avatar Nov 29 '22 18:11 IrinaZinevich

@MickL Would you like to push this forward? If not, @IrinaZinevich @shprink you are more then welcome to pick this up :)

shaharkazaz avatar Dec 16 '22 13:12 shaharkazaz

@rhuitl Can you please update this branch with latest master branch?

shaharkazaz avatar Dec 16 '22 14:12 shaharkazaz

On it as we speak :)

rhuitl avatar Dec 16 '22 14:12 rhuitl

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 avatar Dec 16 '22 17:12 rhuitl

@rhuitl I ran the tests locally on master and they seem to pass. not sure what's causing your issue

shaharkazaz avatar Dec 16 '22 18:12 shaharkazaz

@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.

rhuitl avatar Dec 17 '22 00:12 rhuitl

I think that's because none of the existing tests reads back the translation files and updates them.

  1. So that means that this is directly related to your test, debug it and figure out why this is failing for POT.
  2. I don't think that's related since before each spec you remove the i18n folder.

shaharkazaz avatar Dec 17 '22 07:12 shaharkazaz

@rhuitl Are we logging which keys have been removed? Do you think we should?

shaharkazaz avatar Dec 17 '22 07:12 shaharkazaz

@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.

rhuitl avatar Dec 17 '22 17:12 rhuitl

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 avatar Jan 16 '23 14:01 rhuitl

@rhuitl Not sure why it won't let me 🤔

shaharkazaz avatar Jan 23 '23 16:01 shaharkazaz

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.

rhuitl avatar Jan 23 '23 17:01 rhuitl

Does it let you merge it now?

rhuitl avatar Feb 08 '23 22:02 rhuitl

I added the tests for unflat = false and made the naming changes you suggested.

rhuitl avatar Mar 09 '23 13:03 rhuitl

@rhuitl Thank you for this PR!

shaharkazaz avatar Mar 11 '23 19:03 shaharkazaz

can't wait to try that! thanks a lot everyone!

shprink avatar Mar 28 '23 13:03 shprink