We recommend editing the contents of this repo using the 2i2c Community Showcase Hub.
Note
If you require collaborator access to contribute to this repo, please Get in Touch. Otherwise, you can fork this repository instead.
-
Access the 2i2c Community Showcase Hub at https://showcase.2i2c.cloud/. If you require authorisation to access this hub, please Get in Touch.
-
Select the Shared Small: 1-4 CPU, 8-32 GB server option and in the Image dropdown box select Handbook Authoring.
-
Once the JupyterLab interface has loaded, set up GitHub authentication with
gh-scoped-creds. This allows you to pull and push to GitHub repos securely. To enable this, open a terminal, run the commandgh-scoped-creds
and follow the prompts to enter your code at https://github.com/login/device
-
Git clone this project repo using the Terminal with the command
git clone https://github.com/czi-catalystproject/hub-champion-training.git
-
Follow the instructions in Localisation to Spanish for authoring and previewing content using Jupyter Book.
Caution
We do not recommend entering your GitHub credentials (GitHub password, personal access tokens or otherwise) on any kind of shared infrastructure (e.g. private and public cloud, HPC, any remote machine) as this information will be at risk. We highly advise using gh-scoped-creds for authentication on our hubs. Read this article for more information.
NOTE: GitHub permissions for 2i2c-org and czi-catalystproject owners
These are extra instructions for GitHub 2i2c-org and czi-catalystproject owners to grant permissions to collaborators when requested.
Access to the Community Showcase Hub
Add the Hub Champion to the 2i2c-community-showcase/access-2i2c-showcase team with maintainer rights, and community/test users as a general member of 2i2c-community-showcase. This is so that Hub Admins can then add community users/test users to the access-2i2c-showcase team using their maintainer rights to practise granting access to the Showcase Hub as part of their hub champion training.
Add collaborator to this project repo
Go to the GH repo, click Settings -> Access - Collaborators and teams and add the relevant user or team. Assign the Write role in the first instance (this can be upgraded later if needed).
Info about gh-scoped-creds and GitHub App
The GitHub App 2i2c Community Showcase Hub is currently installed on czi-catalystproject/website and czi-catalystproject/hub-champion-training repos to enable gh-scoped-creds.
The following are instructions for localising the Jupyter Book to Spanish, adapted from the Sphinx documentation.
-
Open a Terminal and navigate to the
hub-champion-trainingfoldercd hub-champion-training/ -
If a
config.pyfile does not exist in this folder, or if you have made changes to_config.yml, then automatically generate this from the_config.ymlwithjupyter-book config sphinx .(See Jupyter Book docs)
-
Generate
.potfiles withgettextto extract all translatable strings from the doctreejupyter-book build --builder custom --custom-builder gettext .The generated
.potfiles will be placed in the_build/gettextdirectory. The.potfiles are empty template files and need to be updated if the source content changes. Themsgidline contains the source text. The emptymsgstrline will eventually contain the actual translation in the.pofile. -
Create
.pofiles in thelocalefolder in thees_LAtarget language (ensure that thelocalefolder matches thelocale_dirssetting in_config.yml)sphinx-intl update -p _build/gettext -d locale -l es_LA
The generated
.pofiles are the files that will contain the actual translations in themsgstrlines that are created in the next step. -
Translate the
.pofiles located inside thelocale/es_LA/LC_MESSAGESfolder as required, e.g. with human translation services, machine translation or professional translation services with Crowdin. -
Build the HTML files in English (the source language)
jupyter-book build . -
Build the HTML files in Spanish (the target language)
jupyter-book config sphinx . sphinx-build -b html -D language=es_LA . _build/html/es
-
Open a new Terminal and navigate to the HTML folder using the command
cd hub-champion-training/_build/html/ -
Run a simple Python webserver with the command
python -m http.server
-
Open a new browser tab and preview the Spanish version of the website by opening the following URL
https://<your-hub-url>/user/<your-username>/proxy/8000/es/index.html
Tip
If you run into the following error
sphinx.errors.SphinxError: This environment is incompatible with the selected builder, please choose another doctree directory.
try cleaning the build outputs first before building again
jupyter-book clean .
jupyter-book build .On push to main:
- The Hub Champion Training website will be deployed at https://czi-catalystproject.github.io/hub-champion-training/ via the GitHub actions defined in
.github/workflows/deploy_website.yml. - Changes to the
localedirectory are uploaded to thel10nbranch on Crowdin via the GitHub actions defined in.github/workflows/crowdin-action-upload.yml.
On cron schedule and manual trigger:
- Approved Crowdin translations will be pushed to the
l10nbranch on GitHub and an automatic PR is opened. - If
l10nbranch already exists on GitHub, then Crowdin translations will be force pushed to thel10nbranch on GitHub to the existing PR. - GitHub action is defined in
.github/workflows/crowdin-action-download.yml.