forked from carpentries/sandpaper
-
Notifications
You must be signed in to change notification settings - Fork 0
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
[pull] main from carpentries:main #10
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
based on {pkgdown} scheme and using {potools}
Co-authored-by: Zhian N. Kamvar <[email protected]>
Co-authored-by: Zhian N. Kamvar <[email protected]>
Co-authored-by: Zhian N. Kamvar <[email protected]>
The reason why the initial apporach I proposed was not working is because this bumps into a few concepts that have not been clearly documented on this end. First, there is the concept of the `pkg` object. This object is a representation of the _pkgdown.yaml file from the `site/` folder. When any page is built, this is passed to `pkgdown::data_template()`, which creates the data needed for the whisker templates (e.g. everything in the `$params` section of the `_pkgdown.yaml` file is shunted into `$yaml`) and boilerplate items like dropdown menu items (for pkgdown) are added. In my original conception, I would be able to add `$translate` to the `pkg` object and it would be propogated to the website. This was not true and this is where the disconnect initially lies. The problem was that the code for `pkgdown::data_template()` was _replacing_ the `$translate` field with the default translations from {pkgdown}. In this package, the way we pass variables to {varnish} via the `_pkgdown.yaml` file, the generated content for `learner_globals()` and `instructor_globals()`, and the `this_metadata()` object, which contains both supplied and generated metadata content. All of these are passed to `build_html()`, which uses `pkgdown::render_page_html()`, passing the generated global data to the `data` parameter and _this_ is where the translations are incorporated.
This will run before pkgdown is run so that we don't have to worry about syntax or messing up HTML. It's not the perfect solution, but it will work.
This replaces it with a more efficient method by translating once and then applying those translations over the nodes. This is still not efficient as can be. The translations _could_ live in yet another global environment that can be initialized when the config file is read in, but we will optimize that later
This function does not need to rely on the pkgdown structure. We have the language recorded in the metadata, so that should be sufficient.
I retrieved some of them from carpentries/styles-es, but I could not translate all of them.
WIP: Add Support for Translations
add data flow vignette
Update DESCRIPTION to use main branch of varnish
I did the remaining translations to Spanish. Thanks so much, @zkamvar and @joelnitta, for building this. Thanks a lot, @acrall, for working so hard in advance in the localization of The Carpentries materials.
potools::po_compile()
Translations R-es.po
milanmlft
approved these changes
Dec 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See Commits and Changes for more details.
Created by
pull[bot]
Can you help keep this open source service alive? 💖 Please sponsor : )