feat: add per-language date format configuration (#556)

This commit is contained in:
Óscar 2025-08-07 14:00:48 +02:00 committed by GitHub
parent 3a40ae5a83
commit 2064beae78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 115 additions and 7 deletions

View file

@ -1,7 +1,7 @@
+++
title = "Lost in Translation? Not with tabi's Multilingual Capabilities"
date = 2023-09-12
updated = 2025-04-02
updated = 2025-08-06
description = "Master the art of serving a global audience through tabi's built-in multilingual features. Learn how to change the default language, add multilingual support, and contribute your own translations."
[taxonomies]
@ -108,6 +108,19 @@ So if you create `i18n/en.toml` in your base directory, tabi will read the stri
Make sure to copy the entire file for that language first, or the theme will fall back to the default English strings.
## How do I customize date formats for different languages?
You can set language-specific date formats in your `config.toml` using the `date_formats` array:
```toml
date_formats = [
{ lang = "es", long = "%d de %B de %Y", short = "%-d %b %Y" },
{ lang = "de", long = "%d. %B %Y", short = "%d.%m.%Y" },
]
```
This allows each language to display dates according to local conventions. For example, Spanish will show "3 de febrero de 2024" while German will show "3. Februar 2024". If no language-specific format is defined, tabi will use the global `long_date_format` and `short_date_format` settings.
## What happens if a translation is missing or incomplete?
If a string is not found in the language file, tabi will fall back to the default English string.