Skip to content
This repository was archived by the owner on Aug 26, 2022. It is now read-only.

Conversation

@jwhitlock
Copy link
Contributor

django-dbgettext was used to extract the Filter and FilterGroup names from the database and create files so that they would be picked up as localizable strings. There's a few issues:

  • This process wasn't documented. We haven't updated the strings for changes to the filters, so they are badly out of sync (see French topic filters).
  • The output is gross, spread over lots of files in kuma/core/translations.
  • We don't have a method for regenerating the files against the production database and then checking in the changes, so any updates would have to be done manually.
  • The project is barely maintained, with a minimal release in 2016 for Django 1.9 compatibility. It uses an auto-discover process that hasn't been updated for AppConfig-style apps, added in Django 1.7.
  • I hope to eventually move Filter and FilterGroup out of the database and into code. I'd like to avoid UI strings defined in the database in the future (I'm looking at you, DocumentTag).

This PR:

  • Drops django-dbgettext, output files, and configuration.
  • Replaces it with a Django management command generate_search_names.
  • Adds kuma/search/names.py with the current names from production.
  • Adds NAME: "jinja2" to the TEMPLATES setting, so that I can get the Jinja2 engine by that name rather than the default backend.

Add generate_search_names management command to extract search Filter
and FilterGroups from the database, so that they can be translated for
the search UI. This replaces the similar string extraction provided by
dbgettext.
dbgettext is not well maintained, and uses a auto-discover routine that
is incompatible with AppConfig-style applications. Translatable strings
have been moved to kuma/search/names.py, refreshed from the database.
@jwhitlock jwhitlock requested a review from escattone February 16, 2018 17:24
Copy link
Contributor

@escattone escattone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jwhitlock!

@escattone escattone merged commit 9410672 into mdn:master Feb 28, 2018
@jwhitlock jwhitlock deleted the drop-dbgettext-1401246 branch May 8, 2018 22:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants