Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

forge-mvc-i18n

Opt-in Forge pour l'internationalisation. Extrait du core (ADR-027) : le core ne contient que les primitives générales ; la traduction est une brique spécialisée, optionnelle.

Contenu

  • trans(key, locale=None, translations_dir="translations") : traduit une clé via le catalogue de la locale, avec repli sur la locale de fallback puis sur la clé elle-même.
  • load_catalog(locale, translations_dir) : charge et valide un catalogue translations/<locale>.json (objet JSON de chaînes), mis en cache.
  • clear_translation_cache() : vide le cache des catalogues.
  • get_default_locale / set_default_locale, get_fallback_locale / set_fallback_locale : pilotent la configuration du noyau (i18n_default_locale, i18n_fallback_locale).
  • Exceptions : I18nError, TranslationCatalogError.

Quand le paquet est installé, le renderer Jinja du noyau expose automatiquement trans() comme fonction globale des templates.

Installation

pip install --pre forge-mvc-i18n

Configuration

Les locales par défaut et de fallback sont des clés du noyau, configurables au démarrage :

import core.forge as forge

forge.configure(i18n_default_locale="fr", i18n_fallback_locale="en")

Exemple

from forge_mvc_i18n import trans

# translations/fr.json -> {"common.save": "Enregistrer"}
trans("common.save")            # "Enregistrer"
trans("inconnu")                # "inconnu" (repli sur la clé)

Release files for forge-mvc-i18n 1.0.0rc8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for forge-mvc-i18n 1.0.0rc8
File Size Uploaded
forge_mvc_i18n-1.0.0rc8.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for forge-mvc-i18n 1.0.0rc8
File Interpreter ABI Platform
forge_mvc_i18n-1.0.0rc8-py3-none-any.whl Python 3 none any Details

Total release size: 36.7 kB

Release files / forge_mvc_i18n-1.0.0rc8.tar.gz

Download URL forge_mvc_i18n-1.0.0rc8.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6b555f956540e2146d78718c6e6646fda69ec3d74b1bb61dfe5f6596b0b5ac45
BLAKE2b-256 checksum
How to use checksums
a3a68bd6a5d32ec7e8d5923b066976d00f6ca554cfdc05f897a9af1b02122b7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / forge_mvc_i18n-1.0.0rc8-py3-none-any.whl

Download URL forge_mvc_i18n-1.0.0rc8-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f67331b06cde611b293d994d1503afdcb3b5f6d461b66e77704273f2e9eb67f1
BLAKE2b-256 checksum
How to use checksums
f7c62ad08a90145cbe9d1a2ec8c44ff72f479e4c08b09b50190048fbadd57477
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page