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

ensure country codes; small refactor of translation strings #554

Merged
merged 8 commits into from
Dec 13, 2023

Conversation

zkamvar
Copy link
Contributor

@zkamvar zkamvar commented Dec 12, 2023

This ensures that codes like es_AR can be used.

It also starts a refactor where the translations for generated pages are not duplicated across files.

There was a problem with the testing which reveals a bit of a fragile
relationship between the translations and the rest of the varnish data.
Likely the translations need to be set during the build time and kept as
a permanent fixutre.
One of the problems that lead me to 7d9cc2c
was the fact that a test for `build_lesson()` was failing in the
situation where we removed the instructor notes page from the source and
rebuilt it using the instructor note aggregator function without the
`build_lesson()` context.

When `this_lesson()` was called, it clobbered the `$translation` items
and then we got an error in that test because the translation for the
title was not available.

I will reiterate that this problem is almost non-existent because none
of the HTML generating functions are exported nor are they called
directly by users, but it still bothers me. In fact, it would be a good
idea to centralise the translation to a single function and always
assume that the global data will always exist. This would help avoid
confusing errors in the language of the lesson (as opposed to the
language of the user).
@zkamvar zkamvar merged commit 9a48be5 into main Dec 13, 2023
@zkamvar zkamvar deleted the ensure-country-codes branch December 13, 2023 14:49
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