BartyCrouch icon indicating copy to clipboard operation
BartyCrouch copied to clipboard

Comments for existing keys not being updated / added

Open whitemarten opened this issue 4 years ago • 4 comments

  • When changing a comment for a translation key that has been added in a previous run of bartycrouch, the corresponding comment line in all translation files will not be updated.
  • When adding an additional comment for the same key, the new comment will not be added.
  • Multiple comments for a key will only appear if they have already been present when bartycrouch found the key for the first time.
  • When manually removing the key from the translation files, all comments will be added as expected.

Example: Step 1: NSLocalizedString("My Key", comment: "the original comment") --> .../en.lproj/Localizable.strings /* the original comment */ "My Key" = "My Key";

Step 2: NSLocalizedString("My Key", comment: "the updated comment") --> .../en.lproj/Localizable.strings /* the original comment */ "My Key" = "My Key";

Step 3: NSLocalizedString("My Key", comment: "the updated comment") NSLocalizedString("My Key", comment: "the additional comment") --> .../en.lproj/Localizable.strings /* the original comment */ "My Key" = "My Key";

whitemarten avatar Aug 21 '19 20:08 whitemarten

Thanks for reporting. Will have a look as soon as I can. There's also #140 which is related to this and would probably be fixed alongside this.

Jeehut avatar Aug 22 '19 05:08 Jeehut

This appears to still be an issue - I edited the string's comment in the code, and the strings files were not updated. Apparently 3.x used to have a command-line flag to overwrite comments but this was removed in 4.x. Suggestions welcome!

mwild1 avatar Dec 10 '21 11:12 mwild1

@mwild1 Thanks for bringing this up. Starting in January, I'm going full-time Indie developer and thus I will be able to invest more time into Open Source development, too. I will have a look at this and other issues most likely in January/February 2022. But I'm always open to reviewing & merging a PR that fixes this in the meantime, so feel free to investigate yourself.

Jeehut avatar Dec 13 '21 08:12 Jeehut

Starting in January, I'm going full-time Indie developer and thus I will be able to invest more time into Open Source development, too.

Congratulations! I've been working full-time on open-source for over a year now, and I don't regret the jump :) Just gotta keep it financially sustainable...

But I'm always open to reviewing & merging a PR that fixes this in the meantime, so feel free to investigate yourself.

Since posting my previous comment, I think the problem may be less straightforward. A subsequent run did update the comments. I'm wondering if only changing comments doesn't regenerate the files (i.e. changing the actual strings would force a regeneration). Or something like that.

I'm trying to overhaul an app to make it localizable, so I'll probably hit this again soon if it's a real problem, and hopefully I'll get a better idea of the specific triggers.

mwild1 avatar Dec 13 '21 10:12 mwild1