diff --git a/.github/workflows/deploy.docs.yml b/.github/workflows/deploy.docs.yml index fd4ae34..7361b68 100644 --- a/.github/workflows/deploy.docs.yml +++ b/.github/workflows/deploy.docs.yml @@ -22,8 +22,8 @@ jobs: pip install -r workshop/content/requirements.txt - name: Build site 📦 run: | - cd workshop/content - zensical build --clean --strict + zensical build --clean --strict --config-file zensical.toml + zensical build --strict --config-file zensical.pt.toml mv site /tmp/ - name: checkout gh-pages branch uses: actions/checkout@master diff --git a/README.md b/README.md index 443a4eb..0925f4c 100644 --- a/README.md +++ b/README.md @@ -45,23 +45,35 @@ zensical serve # website is made available on http://localhost:8000 ### Translating the workshop to a different language -The workshop is setup to support content in different languages, via the [mkdocs-static-i18n](https://pypi.org/project/mkdocs-static-i18n) plugin. To add an additional language to the workshop: - -- in `mkdocs.yml`, section `plugins.i18n.languages`, add a section with at least the `locale`, `name`, and `build` directives. For example, to add Greek: - -```yaml -- locale: el - name: Ελληνικά - build: true -``` - -- foreach `.md` page in `workshop/content/docs`, add an equivalant page in the language with the locale code as part of the filename. For example: +Support to multiple languages is native in Zensical. To add an additional language to the workshop, create another toml file with the locale code as part of the filename. See an example [here](./workshop/content/zensical.pt.toml). + +- To enable the language switcher, update this block at the end of [the main configuration file](./workshop/content/zensical.toml): + ``` + alternate =[ + { name = "English", link = "/", lang = "en" }, + { name = "Português", link = "/pt/", lang = "pt" } + ] + ``` +- foreach `.md` page in `workshop/content/docs`, add an equivalent page in the language with the locale code as part of the filename. For example: - `ogcapi-records.md` -> `ogcapi-records.el.md` +- Update the [GitHub action](https://github.com/geopython/diving-into-pygeoapi/blob/main/.github/workflows/deploy.docs.yml), to also include a build for this language; example: `zensical build --strict --config-file zensical.pt.toml` - commit to your fork and issue a GitHub Pull Request NOTE: see [issue 217](https://github.com/geopython/diving-into-pygeoapi/issues/217) to track the implementation of auto-translation. +Note: Zensical can only serve one language at a time. Example: + `zensical serve --config-file zensical.pt.toml` + +If you want to test the language switcher: build the default English site, build the other language sites and spin up a basic local web server to view the combined output: + + ``` +zensical build --config-file zensical.toml + +zensical build --config-file zensical.pt.toml + +python3 -m http.server --directory site + ``` ## Contributing updates diff --git a/workshop/content/zensical.pt.toml b/workshop/content/zensical.pt.toml new file mode 100644 index 0000000..5278170 --- /dev/null +++ b/workshop/content/zensical.pt.toml @@ -0,0 +1,70 @@ +[project] +site_name = "Diving into pygeoapi" +site_description = "pygeoapi is an OGC Reference Implementation supporting numerous OGC API specifications. This workshop will cover publishing geospatial data to the Web using pygeoapi in support of the suite of OGC API standards." +site_author = "The pygeoapi community" +copyright = "© 2022 - 2026 pygeoapi community" +site_url = "https://dive.pygeoapi.io/" +repo_url = "https://github.com/geopython/diving-into-pygeoapi" +edit_uri = "edit/main/workshop/content/docs" +docs_dir = "docs" +site_dir = "site/pt" +directory_urls = true +extra_css = [ + "assets/stylesheets/pygeoapi.css" +] + +# Native translated nav for Portuguese +nav =[ + { "Início" = "index.pt.md"}, + { "Introdução á pygeoapi" = "introduction.pt.md"}, + { "Configuração do ambiente da workshop" = "setup.pt.md"}, + { "Normas" = "standards.pt.md"}, + { "Publicação" =[ + { "Index" = "publishing/index.md"}, + { "Exercício 1 - O meu primeiro conjunto de dados" = "publishing/first.pt.md"}, + { "Exercício 2 - Dados vetoriais via OGC API - Features" = "publishing/ogcapi-features.pt.md"}, + { "Exercício 3 - Dados raster via OGC API - Coverages" = "publishing/ogcapi-coverages.pt.md"}, + { "Exercício 4 - Mapas de dados geoespaciais via OGC API - Maps" = "publishing/ogcapi-maps.pt.md"}, + { "Exercício 5 - Tiles de dados geoespaciais via OGC API - Tiles" = "publishing/ogcapi-tiles.pt.md"}, + { "Exercício 6 - Metadados via OGC API - Records" = "publishing/ogcapi-records.pt.md"}, + { "Exercício 7 - Dados ambientais via OGC API - Environmental Data Retrieval" = "publishing/ogcapi-edr.pt.md"}, + { "Exercício 8 - Funções via OGC API - Processes" = "publishing/ogcapi-processes.pt.md"} + ]}, + { "Tópicos avançados" =[ + { "Index" = "advanced/index.pt.md"}, + { "Suporte multilíngue" = "advanced/i18n.pt.md"}, + { "Suporte a CRS" = "advanced/crs.pt.md"}, + { "Personalização de UI e templating" = "advanced/ui-custom-templates.pt.md"}, + { "Uso da pygeoapi em aplicações downstream" = "advanced/downstream-applications.pt.md"}, + { "Otimização para mecanismos de busca (SEO)" = "advanced/seo.pt.md"}, + { "Segurança e controle de acessos" = "advanced/security-access-control.pt.md"}, + { "Web Semântica e Linked Data" = "advanced/semantic-web-linked-data.pt.md"}, + { "Implantação na cloud" = "advanced/cloud.pt.md"}, + { "Suporte INSPIRE" = "advanced/inspire.pt.md"}, + { "Administração" = "advanced/administration.pt.md"}, + { "Exercício 9 - pygeoapi como uma ponte para outros serviços" = "advanced/bridges.pt.md"} + ]}, + { "Conclusão" = "conclusion.pt.md"} +] +[project.theme] +language = "pt" +variant = "classic" +primary = "black" +favicon = "assets/favicon.ico" +logo = "assets/images/pygeoapi-icon-notrans.png" +features =[ + "content.action.edit", + "content.action.view", + "navigation.top", + "navigation.tracking.prev_next", + "navigation.tracking.section", + "navigation.indexes" +] + +[project.extra] +homepage = "https://dive.pygeoapi.io" + +alternate =[ + { name = "English", link = "/", lang = "en" }, + { name = "Português", link = "/pt/", lang = "pt" } +] diff --git a/workshop/content/zensical.toml b/workshop/content/zensical.toml index 20a40d2..7ce558f 100644 --- a/workshop/content/zensical.toml +++ b/workshop/content/zensical.toml @@ -104,9 +104,14 @@ features = [ [project.extra] homepage = "https://dive.pygeoapi.io" -default_language = "en" -languages = ["en", "pt"] -generate_language_paths = true +#default_language = "en" +#languages = ["en", "pt"] +#generate_language_paths = true -[i18n.routing] -prefix_default_language = false +#[i18n.routing] +#prefix_default_language = false + +alternate =[ + { name = "English", link = "/", lang = "en" }, + { name = "Português", link = "/pt/", lang = "pt" } +] \ No newline at end of file