WordPress.org

GlotPress

Opened 2 years ago

Last modified 11 months ago

#186 new enhancement

Delete translation set

Reported by: abdessamad idrissi Owned by: somebody
Milestone: 1.0 Priority: major
Version: Component: general
Keywords: has-patch 2nd-opinion Cc: willmot

Description

It would be a good idea to allow admins to delete a complete translation set.

Attachments (1)

186.diff (4.2 KB) - added by willmot 18 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 vanillalounge2 years ago

'Translation set' in GP-speak, means the whole language, translated or not. Being able to delete this might not be a good idea for admins (in the sense of validators), although it does make sense for superadmins.

comment:2 abdessamad idrissi2 years ago

Yes that's what I mean; deleting created translations sets - the same as super admins being able to delete projects.

To experiment, I created a test translation set and now I want to delete it and let only the real project translations... But there's no function to do that yet.

comment:3 defries18 months ago

  • Milestone set to 1.0

comment:4 willmot18 months ago

  • Cc willmot added
  • Keywords has-patch needs-testing added

Had a bash at this, we're running the attached patch on translate.hmn.md.

It adds a (delete) link after (edit) when viewing a single translation set.

Currently it just deletes the translation set from the gp_translation_sets table, it doesn't delete the associated translated strings from gp_translations.

willmot18 months ago

comment:5 tcrsavage18 months ago

Tested this on translate.happytables.com

Seems to work nicely

comment:6 follow-up: vanillalounge17 months ago

it doesn't delete the associated translated strings from gp_translations.

Should it? Needs feedback.

comment:7 in reply to: ↑ 6 willmot17 months ago

  • Keywords 2nd-opinion added; needs-testing removed

Replying to vanillalounge:

it doesn't delete the associated translated strings from gp_translations.

Should it? Needs feedback.

The reason I didn't bother deleting the actual strings is that's also the behaviour of the other delete functions (delete project for example).

If it's decided that deleting a project / translation set should also delete all strings as well then I'd be happy to add the patch.

comment:8 willmot13 months ago

Anything I can do to get this patch committed? It's been running on both of our GlotPress installs for a while.

comment:9 markoheijnen13 months ago

I will test the logic when I have time. It seems like there is a capability check missing in delete_get() but I don't know the code on that place so I can be wrong. Having unit tests to test the delete_get() logic would help.

comment:10 vanillalounge11 months ago

I've played around a bit with this patch. Some notes:

  • Project in gp_projects gets deleted.
  • Everything in gp_translation_sets and gp_translations remains.

Which makes me wonder if it's the right approach, or why doesn't everything get deleted. Since entries in gp_translation_sets are associated with a project_id (gone after project delete) and entries in gp_translation are associated with a translation_set_id, it looks like we're left with a bunch of "floating", unattached entries in both tables.

Assuming the above approach is sound, I suggest to expand the patch to delete those, too.

Note: See TracTickets for help on using tickets.