Skip to content

Commit 5d45d45

Browse files
authored
- put back support to Portuguese translation (#225)
1 parent bf24e8c commit 5d45d45

4 files changed

Lines changed: 105 additions & 18 deletions

File tree

.github/workflows/deploy.docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
pip install -r workshop/content/requirements.txt
2323
- name: Build site 📦
2424
run: |
25-
cd workshop/content
26-
zensical build --clean --strict
25+
zensical build --clean --strict --config-file zensical.toml
26+
zensical build --strict --config-file zensical.pt.toml
2727
mv site /tmp/
2828
- name: checkout gh-pages branch
2929
uses: actions/checkout@master

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,35 @@ zensical serve # website is made available on http://localhost:8000
4545

4646
### Translating the workshop to a different language
4747

48-
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:
49-
50-
- in `mkdocs.yml`, section `plugins.i18n.languages`, add a section with at least the `locale`, `name`, and `build` directives. For example, to add Greek:
51-
52-
```yaml
53-
- locale: el
54-
name: Ελληνικά
55-
build: true
56-
```
57-
58-
- 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:
48+
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).
49+
50+
- To enable the language switcher, update this block at the end of [the main configuration file](./workshop/content/zensical.toml):
51+
```
52+
alternate =[
53+
{ name = "English", link = "/", lang = "en" },
54+
{ name = "Português", link = "/pt/", lang = "pt" }
55+
]
56+
```
57+
- 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:
5958
- `ogcapi-records.md` -> `ogcapi-records.el.md`
59+
- 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`
6060
6161
- commit to your fork and issue a GitHub Pull Request
6262
6363
NOTE: see [issue 217](https://github.com/geopython/diving-into-pygeoapi/issues/217) to track the implementation of auto-translation.
6464
65+
Note: Zensical can only serve one language at a time. Example:
66+
`zensical serve --config-file zensical.pt.toml`
67+
68+
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:
69+
70+
```
71+
zensical build --config-file zensical.toml
72+
73+
zensical build --config-file zensical.pt.toml
74+
75+
python3 -m http.server --directory site
76+
```
6577
6678
## Contributing updates
6779

workshop/content/zensical.pt.toml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[project]
2+
site_name = "Diving into pygeoapi"
3+
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."
4+
site_author = "The pygeoapi community"
5+
copyright = "© 2022 - 2026 pygeoapi community"
6+
site_url = "https://dive.pygeoapi.io/"
7+
repo_url = "https://github.com/geopython/diving-into-pygeoapi"
8+
edit_uri = "edit/main/workshop/content/docs"
9+
docs_dir = "docs"
10+
site_dir = "site/pt"
11+
directory_urls = true
12+
extra_css = [
13+
"assets/stylesheets/pygeoapi.css"
14+
]
15+
16+
# Native translated nav for Portuguese
17+
nav =[
18+
{ "Início" = "index.pt.md"},
19+
{ "Introdução á pygeoapi" = "introduction.pt.md"},
20+
{ "Configuração do ambiente da workshop" = "setup.pt.md"},
21+
{ "Normas" = "standards.pt.md"},
22+
{ "Publicação" =[
23+
{ "Index" = "publishing/index.md"},
24+
{ "Exercício 1 - O meu primeiro conjunto de dados" = "publishing/first.pt.md"},
25+
{ "Exercício 2 - Dados vetoriais via OGC API - Features" = "publishing/ogcapi-features.pt.md"},
26+
{ "Exercício 3 - Dados raster via OGC API - Coverages" = "publishing/ogcapi-coverages.pt.md"},
27+
{ "Exercício 4 - Mapas de dados geoespaciais via OGC API - Maps" = "publishing/ogcapi-maps.pt.md"},
28+
{ "Exercício 5 - Tiles de dados geoespaciais via OGC API - Tiles" = "publishing/ogcapi-tiles.pt.md"},
29+
{ "Exercício 6 - Metadados via OGC API - Records" = "publishing/ogcapi-records.pt.md"},
30+
{ "Exercício 7 - Dados ambientais via OGC API - Environmental Data Retrieval" = "publishing/ogcapi-edr.pt.md"},
31+
{ "Exercício 8 - Funções via OGC API - Processes" = "publishing/ogcapi-processes.pt.md"}
32+
]},
33+
{ "Tópicos avançados" =[
34+
{ "Index" = "advanced/index.pt.md"},
35+
{ "Suporte multilíngue" = "advanced/i18n.pt.md"},
36+
{ "Suporte a CRS" = "advanced/crs.pt.md"},
37+
{ "Personalização de UI e templating" = "advanced/ui-custom-templates.pt.md"},
38+
{ "Uso da pygeoapi em aplicações downstream" = "advanced/downstream-applications.pt.md"},
39+
{ "Otimização para mecanismos de busca (SEO)" = "advanced/seo.pt.md"},
40+
{ "Segurança e controle de acessos" = "advanced/security-access-control.pt.md"},
41+
{ "Web Semântica e Linked Data" = "advanced/semantic-web-linked-data.pt.md"},
42+
{ "Implantação na cloud" = "advanced/cloud.pt.md"},
43+
{ "Suporte INSPIRE" = "advanced/inspire.pt.md"},
44+
{ "Administração" = "advanced/administration.pt.md"},
45+
{ "Exercício 9 - pygeoapi como uma ponte para outros serviços" = "advanced/bridges.pt.md"}
46+
]},
47+
{ "Conclusão" = "conclusion.pt.md"}
48+
]
49+
[project.theme]
50+
language = "pt"
51+
variant = "classic"
52+
primary = "black"
53+
favicon = "assets/favicon.ico"
54+
logo = "assets/images/pygeoapi-icon-notrans.png"
55+
features =[
56+
"content.action.edit",
57+
"content.action.view",
58+
"navigation.top",
59+
"navigation.tracking.prev_next",
60+
"navigation.tracking.section",
61+
"navigation.indexes"
62+
]
63+
64+
[project.extra]
65+
homepage = "https://dive.pygeoapi.io"
66+
67+
alternate =[
68+
{ name = "English", link = "/", lang = "en" },
69+
{ name = "Português", link = "/pt/", lang = "pt" }
70+
]

workshop/content/zensical.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,14 @@ features = [
104104
[project.extra]
105105
homepage = "https://dive.pygeoapi.io"
106106

107-
default_language = "en"
108-
languages = ["en", "pt"]
109-
generate_language_paths = true
107+
#default_language = "en"
108+
#languages = ["en", "pt"]
109+
#generate_language_paths = true
110110

111-
[i18n.routing]
112-
prefix_default_language = false
111+
#[i18n.routing]
112+
#prefix_default_language = false
113+
114+
alternate =[
115+
{ name = "English", link = "/", lang = "en" },
116+
{ name = "Português", link = "/pt/", lang = "pt" }
117+
]

0 commit comments

Comments
 (0)