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

Add l10n support #105

Merged
merged 15 commits into from Dec 7, 2023
Merged

Add l10n support #105

merged 15 commits into from Dec 7, 2023

Conversation

zkamvar
Copy link
Contributor

@zkamvar zkamvar commented Nov 28, 2023

This is to be paired with carpentries/sandpaper#546.

NOTE: this should be released after carpentries/sandpaper#546

This replaces bare text elements with {{ translate.Key }} where translate.Key is a keyword written in PascalCase to the translation variable in {sandpaper}

For example, the words "Instructor Notes" have the key {{ translate.InstructorNotes }} because the data for the mustache template will contain a list called "translate", which will contain an item called "InstructorNotes" containing the translation for "Instructor Notes":

dat <- list(
  translate = list(
    InstructorNotes = tr_("Instructor Notes")
  )
)

We are assuming that these elements will be available, which is why we do not test for them.

There are some elements that contain HTML and are escaped (e.g. {{& translate.EstimatedTime }}.

zkamvar and others added 13 commits November 29, 2023 11:22
This will accomodate the awkward back to top text where the "Back"
portion will disappear on smaller width screens 🤷
Both Expand/Collapse Solutions and Collapse/Episodes (for the sidebar)
had the text hard-coded into the JavaScript, which made implementing
translations difficult.

Since both of these buttons have binary states, I added the translations
as data attributes in the HTML element itself so that the JavaScript could
pull from those attributes to insert the proper text.
@zkamvar zkamvar marked this pull request as ready for review December 5, 2023 19:49
@zkamvar
Copy link
Contributor Author

zkamvar commented Dec 7, 2023

The sandpaper PR has been merged, so I will now merge this.

@zkamvar zkamvar merged commit 2e62ad2 into main Dec 7, 2023
1 check passed
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

2 participants