Update weblab model to do I18n.t translations #51846
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
omg y'all I've been spelunking.
It all started with P20-164 a totally innocent report that 14 lessons don't have translations showing.
And it was a great way to learn about the i18n pipeline and how the whole system works! So I took a look
Full saga below the fold
appOptions
appOptions
come from server-side? For levels that are translated, like this one the longInstructions in thatappOptions
are already in Spanish so the server is sending in localized input.levels_helper.rb
you can see a method calledapp_options
that puts together all of this configuration data. Within theapp_options
, we only really care about thelevel_options
- data specific to the level, not the user or other configuration. This is set down here since this is anon_blockly_puzzle_level
.I copied over the logic from the
free_response.rb
model over into theweblab.rb
model.Testing story
In production: you can tell from the title that the locale is Spanish but that the instructions are still in English
In development: the instructions are now in Spanish too!
In development: in English, the instructions are still in English
Follow-up work
This only fixes weblab levels, in looking through
s/allthethings/
in Spanish there are a couple other level types that don't have translations visible but I'm not sure how important updating them are (blocks are the bread and butter).It also seems like FND=985 was created to do this as a platform wide solution but 馃し it seems to have been de-prioritized.
#32650
PR Checklist: