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

[i18n] Add locale to cache key - weblab #52067

Merged
merged 3 commits into from May 25, 2023
Merged

[i18n] Add locale to cache key - weblab #52067

merged 3 commits into from May 25, 2023

Conversation

elf-code
Copy link
Contributor

@elf-code elf-code commented May 24, 2023

Followup to #51846 because in prod, the translated instructions don't always show up.
Jira ticket - https://codedotorg.atlassian.net/browse/P20-164

Problem: After updating with #51846 , when I would view translated instructions they would sometimes load with the Spanish instructions and sometimes load with English instructions.

I noticed that ailab has the locale in their cache key so update weblab to do similar!

Testing story

I'm not confident that this will fix the issue, but I am confident that it can't hurt.

In development, we don't have caching on so every time you hit the database for the results for long instructions.

I changed that line to config.cache_store = :file_store, "/tmp/rails_cache/" and then could see cache files show up for the level (and language) I was requesting -

➜  ~ ls /tmp/rails_cache/5A2/6F1/levels%2F5314%2Fen-US%2Fnon_blockly_puzzle_level_options%2Fv2
/tmp/rails_cache/5A2/6F1/levels%2F5314%2Fen-US%2Fnon_blockly_puzzle_level_options%2Fv2
➜  ~ ls /tmp/rails_cache/FAE/810/lessons%2F3204%2Flesson_summary%2Fen-US%2Ftrue 
/tmp/rails_cache/FAE/810/lessons%2F3204%2Flesson_summary%2Fen-US%2Ftrue
➜  ~ ls /tmp/rails_cache/597/AB1/levels%2F5314%2Fes-ES%2Fnon_blockly_puzzle_level_options%2Fv2
/tmp/rails_cache/597/AB1/levels%2F5314%2Fes-ES%2Fnon_blockly_puzzle_level_options%2Fv2

Checklist

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

Also I'm not sure how my commit history has a Hamms commit in it, but I think it's already in staging

@elf-code elf-code requested review from mgc1194 and a team May 24, 2023 20:10
@elf-code elf-code marked this pull request as ready for review May 24, 2023 20:10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes are only line-length changes within the comments at the top of the file (cause Dayne pointed me here but it was really hard to read the comment).

Copy link
Contributor

@nicklathe nicklathe left a comment

Choose a reason for hiding this comment

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

Makes sense to me, :shipit:

@elf-code elf-code merged commit 82f1387 into staging May 25, 2023
2 checks passed
@elf-code elf-code deleted the elf-i18n-caching branch May 25, 2023 13:05
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.

None yet

3 participants