Skip to content

Add language switcher #144

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build_and_deploy_site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Deploy Site

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
# https://github.com/ruby/setup-ruby/releases/tag/v1.207.0
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
with:
bundler-cache: true
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" --source content/
env:
JEKYLL_ENV: production
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ build:
- ~/.rvm/bin/rvm autolibs disable && ~/.rvm/bin/rvm install ruby 3.4.3
- PATH="$HOME/.rvm/rubies/ruby-3.4.3/bin:$PATH" gem install bundler
- PATH="$HOME/.rvm/rubies/ruby-3.4.3/bin:$PATH" bundle install
- PATH="$HOME/.rvm/rubies/ruby-3.4.3/bin:$PATH" bundle exec jekyll build --destination _readthedocs/html --baseurl $(echo -n "$READTHEDOCS_CANONICAL_URL" | cut -d '/' -f 4-)
- PATH="$HOME/.rvm/rubies/ruby-3.4.3/bin:$PATH" bundle exec jekyll build --source content/ --destination _readthedocs/html --baseurl $(echo -n "$READTHEDOCS_CANONICAL_URL" | cut -d '/' -f 4-)
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.4.1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ RUN apt-get install ruby-dev -y
RUN apt-get install make gcc g++ -y
RUN bundle install
RUN cat Gemfile.lock
ENTRYPOINT bundle exec jekyll serve
ENTRYPOINT bundle exec jekyll serve --source content/
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gem "github-pages", group: :jekyll_plugins
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.17"
gem "jekyll-include-cache", "~> 0.2"
gem "jekyll-sitemap", "~> 1.4"
gem "copy", :path => "./content/_plugins/copy/"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
7 changes: 6 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
PATH
remote: content/_plugins/copy
specs:
copy (0.1.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -303,11 +308,11 @@ PLATFORMS
x86_64-linux-musl

DEPENDENCIES
copy!
github-pages
jekyll-feed (~> 0.17)
jekyll-include-cache (~> 0.2)
jekyll-redirect-from
jekyll-sitemap (~> 1.4)
kramdown-parser-gfm
tzinfo-data
webrick (~> 1.8)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ bundle install
5. Build and serve the site locally:

```
bundle exec jekyll serve
bundle exec jekyll serve --source content/
```
11 changes: 0 additions & 11 deletions _includes/head/custom.html

This file was deleted.

File renamed without changes.
File renamed without changes.
20 changes: 18 additions & 2 deletions _config.yml → content/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.

# Localized content for title subtitle and description is located at ''./en/_data/messages.yml'
# and './_data/en/messages.yml'
title: Zarr
subtitle: chunked, compressed, N-dimensional arrays

description: >- # this means to ignore newlines until "baseurl:"

Zarr is an open source project developing specifications and
software libraries for storage of data that is structured as
N-dimensional typed arrays (also known as tensors) in a way that is
compatible with parallel and distributed computing applications.

baseurl: "" # the subpath of your site, e.g. /blog
# baseurl: "/zarr-developers.github.io" # the subpath of your site, e.g. /blog

url: "" # the base hostname & protocol for your site, e.g. http://example.com

Expand Down Expand Up @@ -86,3 +87,18 @@ footer:
- label: "Zulip"
icon: "fas fa-comments"
url: "https://ossci.zulipchat.com/"

head_scripts:
- assets/js/language_switcher.js

# Add new languages as translations become available.
# Status of translations can be found at:
# https://scientific-python-translations.github.io/status/#zarrdev
default_language: 'en'
languages:
- prefix: 'en'
label: 'English'
- prefix: 'es'
label: 'Español'
- prefix: 'pt'
label: 'Português'
10 changes: 10 additions & 0 deletions content/_data/en/messages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: Zarr
subtitle: chunked, compressed, N-dimensional arrays
description: >-

Zarr is an open source project developing specifications and
software libraries for storage of data that is structured as
N-dimensional typed arrays (also known as tensors) in a way that is
compatible with parallel and distributed computing applications.

toggle-menu: Toggle Menu
25 changes: 12 additions & 13 deletions _data/navigation.yml → content/_data/en/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,38 @@ main:
url: "https://zarr.readthedocs.io/en/stable/developers/contributing.html"
- title: "Python Quickstart"
url: "https://zarr.readthedocs.io/en/stable/quickstart.html"

sidebar:
- title: About
children:
- title: "Description"
url: '#description'
url: "#description"
- title: "Applications"
url: '#applications'
url: "#applications"
- title: "Features"
url: '#features'
url: "#features"
- title: "Sponsorship"
url: "#sponsorship"
- title: "Videos"
url: "#videos"
- title: Subpages
children:
- title: "Adopters"
url: "/adopters"
url: "adopters/"
- title: "Blog"
url: '/blog'
url: "/blog/"
- title: "Community"
url: '/community'
url: "community/"
- title: "Conventions"
url: '/conventions'
url: "conventions/"
- title: "Datasets"
url: '/datasets'
url: "datasets/"
- title: "Implementations"
url: '/implementations'
url: "implementations/"
- title: "Office Hours"
url: "/office-hours"
url: "office-hours/"
- title: "Slides"
url: "/slides"
url: "/slides/"
- title: "Specification"
url: https://zarr-specs.readthedocs.io/
- title: "ZEPs"
url: '/zeps'
url: "/zeps/"
6 changes: 6 additions & 0 deletions content/_data/es/messages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: Zarr
subtitle: matrices fragmentadas, comprimidas y N-dimensionales
description: >-
Zarr es un proyecto de código abierto que desarrolla especificaciones y bibliotecas de software para el almacenamiento de datos estructurados como matrices tipadas N-dimensionales (también conocidas como tensores) de una manera que sea compatible con aplicaciones informáticas paralelas y distribuidas.
toggle-menu: Menú

42 changes: 42 additions & 0 deletions content/_data/es/navigation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
main:
- title: "Documentación"
url: "https://zarr.readthedocs.io/en/stable/"
- title: "Contribuir"
url: "https://zarr.readthedocs.io/en/stable/developers/contributing.html"
- title: "Inicie con Python"
url: "https://zarr.readthedocs.io/en/stable/quickstart.html"
sidebar:
- title: "Acerca de"
children:
- title: "Descripción"
url: '#descripción'
- title: "Aplicaciones"
url: '#aplicaciones'
- title: "Características"
url: '#características'
- title: "Patrocinio"
url: "#patrocinio"
- title: "Vídeos"
url: "#videos"
- title: "Subpáginas"
children:
- title: "Usuarios"
url: "adopters/"
- title: "Blog"
url: "/blog/"
- title: "Comunidad"
url: "community/"
- title: "Convenciones"
url: "conventions/"
- title: "Conjuntos de datos"
url: "datasets/"
- title: "Implementaciones"
url: "implementations/"
- title: "Horarios de oficina"
url: "office-hours/"
- title: "Diapositivas"
url: "/slides/"
- title: "Especificación"
url: "https://zarr-specs.readthedocs.io/"
- title: "ZEPs"
url: "/zeps/"
7 changes: 7 additions & 0 deletions content/_data/pt/messages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Zarr
subtitle: matrizes N-dimensionais, compactadas e fragmentadas
description: >-

Zarr é um projeto de código aberto que desenvolve especificações e bibliotecas de software para armazenamento de dados que é estruturado como matrizes tipadas N-dimensionais (também conhecidas como tensoras) de uma forma que é compatível com aplicações de computação paralelas e distribuídas.
content: Conteúdo
toggle-menu: Menu
42 changes: 42 additions & 0 deletions content/_data/pt/navigation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
main:
- title: "Documentação"
url: "https://zarr.readthedocs.io/en/stable/"
- title: "Contribuir"
url: "https://zarr.readthedocs.io/en/stable/developers/contributing.html"
- title: "Python Quickstart"
url: "https://zarr.readthedocs.io/en/stable/quickstart.html"
sidebar:
- title: "Sobre"
children:
- title: "Descrição"
url: '#descrição'
- title: "Aplicações"
url: '#aplicações'
- title: "Recursos"
url: '#recursos'
- title: "Patrocínio"
url: "#patrocínio"
- title: "Vídeos"
url: "#vídeos"
- title: "Subpáginas"
children:
- title: "Adotantes"
url: "adopters/"
- title: "Blog"
url: "/blog/"
- title: "Comunidade"
url: "community/"
- title: "Convenções"
url: "conventions/"
- title: "Conjuntos de dados"
url: "datasets/"
- title: "Implementacões"
url: "implementations/"
- title: "Reuniões"
url: "office-hours/"
- title: "Apresentações (EN)"
url: "/slides/"
- title: "Especificação"
url: "https://zarr-specs.readthedocs.io/"
- title: "ZEPs"
url: "/zeps/"
11 changes: 11 additions & 0 deletions content/_includes/head/custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- favicon by https://realfavicongenerator.net/ -->
<link rel="apple-touch-icon" sizes="180x180" href="{{ '/apple-touch-icon.png?v=5' | relative_url }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ '/favicon-32x32.png?v=5' | relative_url }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ '/favicon-16x16.png?v=5' | relative_url }}">
<link rel="manifest" href="{{ '/site.webmanifest?v=5' | relative_url }}">
<link rel="mask-icon" href="{{ '/safari-pinned-tab.svg?v=5' | relative_url }}" color="#5bbad5">
<link rel="shortcut icon" href="{{ '/favicon.ico?v=5' | relative_url }}">
<meta name="apple-mobile-web-app-title" content="Zarr">
<meta name="application-name" content="Zarr">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="theme-color" content="#ffffff">
59 changes: 59 additions & 0 deletions content/_includes/masthead.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{%- comment -%}
https://github.com/mmistakes/minimal-mistakes/blob/4.26.2/_includes/masthead.html
{%- endcomment -%}

{% assign page_language = page.url | slice: 1, 2 %}
{% assign languages = "" | split: ',' %}
{% for lang_data in site.languages %}
{% assign languages = languages | push: lang_data.prefix %}
{% endfor %}

{% unless languages contains page_language %}
{% assign page_language = site.default_language %}
{% endunless %}

{% capture logo_path %}{{ site.logo }}{% endcapture %}
<div class="masthead">
<div class="masthead__inner-wrap">
<div class="masthead__menu">
<nav id="site-nav" class="greedy-nav">
{% unless logo_path == empty %}
<a class="site-logo" href="{{ ('/' |append: page_language | append: '/') | relative_url }}"><img src="{{ logo_path | relative_url }}" alt="{{ site.masthead_title | default: site.title }}"></a>
{% endunless %}
<a class="site-title" href="{{ ('/' |append: page_language | append: '/') | relative_url }}">
{{ site.data[page_language].messages.title }}
<span class="site-subtitle">{{ site.data[page_language].messages.subtitle }}</span>
</a>
<ul class="visible-links">
{%- for link in site.data[page_language].navigation.main -%}
<li class="masthead__menu-item">
<a
href="{{ link.url | relative_url }}"
{% if link.description %} title="{{ link.description }}"{% endif %}
{% if link.target %} target="{{ link.target }}"{% endif %}
>{{ link.title }}</a>
</li>
{%- endfor -%}
</ul>
{% if site.search == true %}
<div class="masthead__dropdown">
<select class="" style="box-shadow: none; background-color: unset; margin-bottom: 0px;" onchange="change_language()" id="select_language">
{% for lang_data in site.languages %}
<option value="{{ lang_data.prefix }}">{{ lang_data.label }}</option>
{% endfor %}
</select>
</div>
<button class="search__toggle" type="button">
<span class="visually-hidden">{{ site.data.ui-text[site.locale].search_label | default: "Toggle search" }}</span>
<i class="fas fa-search"></i>
</button>
{% endif %}
<button class="greedy-nav__toggle hidden" type="button">
<span class="visually-hidden">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle menu" }}</span>
<div class="navicon"></div>
</button>
<ul class="hidden-links hidden"></ul>
</nav>
</div>
</div>
</div>
Loading