Skip to content

Compute translation stats during build #1

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

Open
wants to merge 1 commit into
base: feat/translation-graph-render
Choose a base branch
from

Conversation

sneakers-the-rat
Copy link

Here's an example of how we might avoid needing to version translation stats (and have them be potentially incorrect, require an extra stage to update, etc.)

all this does is

  • moves the calculation code into the same module (because this isn't a package rly, and so we can't treat it like one and import things from different places without munging sys.path)
  • removed versioned copy of _static/translation_stats.json
  • returns the results of the translation stats computation rather than writes them
  • computes them on demand when rendering the graph
  • writes them to .json at the end of the build into the build directory rather than the repo.

it's totally fast enough to calculate the translation stats on demand - it takes about 100ms on my machine, so even though this implementation does it twice (once when drawing the graph, and once to save to json at the end of the build) it's fine.

i kept the json output in case we wanted to make that programmatically available from the site for any reason, but put the i/o in a separate function from the computation :)

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.

1 participant