Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App: improve title translation, add caching, enable debug toolbar #469

Merged
merged 13 commits into from
Jul 15, 2024

Conversation

TimidRobot
Copy link
Member

@TimidRobot TimidRobot commented Jul 15, 2024

Fixes

Description

App: improve title translation, add caching, enable debug toolbar

  • standardize title generation to a single function so that titles are consistent throughout each document
    • prioritize legal code translation domain over Deeds & UX translation domain
    • add caching so additional overhead only causes a ~30 seconds of additional processing time on a full publish, instead of an additional ~6 minutes
      • (additional overhead is most significantly caused by older tools loading a legal code translation domain so they can recommend using the newer tool by title.)
    • update title formula per previous pull request:
    • (this update is also necessary to support new translation workflow with Transifex as the source of legal code translations instead of legacy HTML files)
  • remove unused code from manage.py
  • improve dev/coverage.sh
    • update to use my common bash script conventions
    • add HTML report generation to make test writing easier to debug
  • improve dev/stats.sh
    • improve consistency of my common bash script conventions
  • properly enable the Django debug toolbar

Also see Data pull request:

Technical details

  • Local-memory caching | Django’s cache framework | Django documentation | Django
  • There is at least one occurrence when the Deeds & UX translation domain is used instead of the appropriate legal code translation domain
    Language Translation domain Value
    English (source) CC0 1.0 Universal
    German Legal code (zero_10) CC0 1.0 Universal
    German Deeds & UX (django) CC0 1.0 Universell
    • The code compares the legal code translation to English and falls back to Deeds & UX translation if it matches. Because the legal code translation uses the same spelling as English, it is depriortized 🤷🏻
    • The code must fallback to the Deeds & UX translation because the deeds are translated into languages that the legal code has not yet been translated into.

Tests

command:

./dev/coverage.sh

output excerpt:

Name    Stmts   Miss Branch BrPart    Cover   Missing
-----------------------------------------------------
TOTAL    1721      0    660      0  100.00%

20 files skipped due to complete coverage.

Screenshots

The following screenshots show the Django Debug Toolbar cache details panel for http://127.0.0.1:8005/licenses/by/3.0/deed.en (Deed - Attribution 3.0 Unported - Creative Commons):

First render with cache misses

Screenshot 2024-07-15 at 05-50-07 Deed - Attribution 3 0 Unported - Creative Commons

Subsequent render with cache hits

Screenshot 2024-07-15 at 05-50-19 Deed - Attribution 3 0 Unported - Creative Commons

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Copy link

@possumbilities possumbilities left a comment

Choose a reason for hiding this comment

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

Wow, impressive!

Approved!

@TimidRobot TimidRobot merged commit e12d4e8 into main Jul 15, 2024
3 checks passed
@TimidRobot TimidRobot deleted the improve-title-translation branch July 15, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] License 4.0 Māori translations are missing translations (that were present in ccEngine)
2 participants