🌐 feat(i18n): overhaul translation system & add languages (#145)

Revamp the existing translation system, simplifying
management and adding several new languages. The new system reads from
TOML files in the `/i18n` directory and improves template structures.
It also enhances customisation options and robustness by providing
fallbacks and modularity.

- Implement a new, streamlined translation macro.
- Load translations from `/i18n` TOML files.
- Remove redundant configuration requirements.
- Refactor templates to align with new i18n system.
- Add support for Hindi, Japanese, Russian, Portuguese, Chinese,
  Italian, German, Ukranian, Korean, and French languages.
- Credit Thomas Weitzel (@thomasweitzel) for inspiration.
This commit is contained in:
Óscar
2023-09-12 18:58:58 +02:00
committed by GitHub
parent 327545f2d5
commit 32a2d5094b
46 changed files with 1534 additions and 483 deletions

View File

@@ -6,29 +6,26 @@ generate_feed = true
compile_sass = true
minify_html = true
# To translate the entire theme, there must be a file with the same ISO 639-1 Code
# in the `i18n` folder of your site or the tabi theme (e.g. "i18n/fr.toml" for French).
# Otherwise the theme will be in English.
# See https://welpo.github.io/tabi/blog/faq-languages/ for more details.
default_language = "en"
taxonomies = [
{name = "tags", feed = true},
]
taxonomies = [{name = "tags", feed = true}]
[markdown]
external_links_target_blank = true
highlight_code = true
highlight_theme = "css"
default_language = "en"
[languages.es]
title = "~/tabi"
description = "tabi es un tema de Zola rápido, liviano y moderno con JavaScript opcional y una puntuación perfecta en Lighthouse."
generate_feed = true
compile_sass = true
minify_html = true
taxonomies = [
{name = "tags", feed = true},
]
taxonomies = [{name = "tags", feed = true}]
[languages.ca]
title = "~/tabi"
@@ -36,112 +33,9 @@ description = "tabi és un tema de Zola ràpid, lleuger i modern amb JavaScript
generate_feed = true
compile_sass = true
minify_html = true
taxonomies = [
{name = "tags", feed = true},
]
[languages.es.translations]
language_name = "Español"
date_locale = "es_ES"
# Menu items.
blog = "blog"
archive = "archivo"
tags = "etiquetas"
words = "palabras"
projects = "proyectos"
# Other text.
tags_title = "Todas las etiquetas"
404_error = "La página que has solicitado parece no existir o aún no se ha traducido a tu idioma. Revisa la URL en busca de errores o"
go_home = "regresa a la página de inicio"
read_more = "Leer más"
all_posts = "Todas las entradas"
all_tags = "Todas las etiquetas"
min_read = "min de lectura"
powered_by = "Impulsado por"
and = "y"
post = "entrada"
posts = "entradas"
prev = "Anterior"
next = "Siguiente"
of = "de"
draft = "BORRADOR"
table_of_contents = "Tabla de contenido"
last_updated_on = "Última actualización el"
show_original_quote = "Mostrar cita original"
show_translation = "Mostrar traducción"
load_comments = "Cargar comentarios"
see_changes = "Ver cambios"
site_source = "Código del sitio"
# Quotation marks for multilingual quote shortcode.
open_quotation_mark = "«"
close_quotation_mark = "»"
# Translations for stylised Atom feed.
this_is_a_web_feed = "Esta es una fuente web"
also_known_as_an_Atom_feed = "también conocida como fuente Atom"
subscribe = "Suscríbete"
by_copying_the_URL_from_the_address_bar_into_your_newsreader = "copiando la URL de la barra de direcciones en tu lector de noticias"
visit = "Visita"
to_learn_more_and_get_started = "para aprender más y empezar"
it_s_free = "Es gratis"
website = "la web"
recent_posts = "Publicaciones recientes"
[languages.ca.translations]
language_name = "Català"
date_locale = "ca_ES"
# Menu items.
blog = "blog"
archive = "arxiu"
tags = "etiquetes"
words = "paraules"
projects = "projectes"
# Other text.
tags_title = "Totes les etiquetes"
404_error = "La pàgina que has sol·licitat sembla que no existeix o encara no s'ha traduït al teu idioma. Comprova l'URL per detectar errors o"
go_home = "torna a la pàgina d'inici"
read_more = "Llegir més"
all_posts = "Totes les entrades"
all_tags = "Totes les etiquetes"
min_read = "min de lectura"
powered_by = "Propulsat per"
and = "i"
post = "entrada"
posts = "entrades"
prev = "Anterior"
next = "Següent"
of = "de"
draft = "ESBORRANY"
table_of_contents = "Taula de contingut"
last_updated_on = "Última actualizació el"
show_original_quote = "Mostra la cita original"
show_translation = "Mostra la traducció"
load_comments = "Carregar comentaris"
see_changes = "Veure canvis"
site_source = "Codi del lloc"
# Quotation marks for multilingual quote shortcode.
open_quotation_mark = "«"
close_quotation_mark = "»"
# Translations for stylised Atom feed.
this_is_a_web_feed = "Aquest és un canal web"
also_known_as_an_Atom_feed = "també conegut com a canal Atom"
subscribe = "Subscriu-te"
by_copying_the_URL_from_the_address_bar_into_your_newsreader = "copiant l'URL de la barra d'adreces al teu lector de notícies"
visit = "Visita"
to_learn_more_and_get_started = "per aprendre més i començar"
it_s_free = "És gratuït"
website = "la web"
recent_posts = "Publicacions recents"
taxonomies = [{name = "tags", feed = true}]
[extra]
# Languages for your site.
# Each should have a translation section above.
# e.g. [languages.ca.translations]
language_name.ca = "Català"
language_name.en = "English"
language_name.es = "Español"
# Enable JavaScript theme toggler to allow users to switch between dark/light mode.
# Also enables automatic switching based on user's OS-level theme settings.
# If disabled, your site will only use the theme specified in the `default_theme` variable.