Page MenuHomePhabricator

SPIKE: Investigate how to make tags translatable
Closed, ResolvedPublic

Description

Since tags are controlled by Taggit, we should investigate how to create translatable tags via Taggit.

Event Timeline

+Thought on this; if it seems involved/complicated we should also assess whether moving away from Taggit is a more sensible idea (whether to a different application or our own).

On further investigation, I think we should stop using Taggit for tags and instead use a JSON field that will store the translation keys for the tags. This JSONField can be validated via JSONSchema to check that only our chosen tags are stored.

For example, a tag JSONField can be like this:

{
    "tags": ["medical_translation", "biology_translation", "physics_translation"]
}

This way, we can search our locale files with those keys to get the translations.

Additional questions:

  • Is the old_tags field still valid? There is a comment that says # This field has to stick around until all servers are using the new tags. Has this happened? Do we have to take this field into account?
  • Will we still use slug and meta_url fields? Having these fields might change the composition of the JSONField

Sorry for the slow reply:

  • old_tags can get dumped
  • we could probably drop slug? I think we're using pks in all the places where we link tags anyway. If we wanted to stop doing that and use strings for tag links, we could probably just use the English message?
  • I actually can't see where meta_url gets surfaced anywhere in the interface, I think this field was originally put in by Andromeda, and I don't have any insight into its use, other than what's in the comments

Marking it as done since it's been discussed in our engineering meeting.