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.0rc7

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.0rc7
File Size Uploaded
forge_mvc_i18n-1.0.0rc7.tar.gz 5.4 kB Details

Built distribution (wheel)

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

Total release size: 11.1 kB

Release files / forge_mvc_i18n-1.0.0rc7.tar.gz

Download URL forge_mvc_i18n-1.0.0rc7.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4fcf8517627b239fd443cf78a185143e8b7ce2aaf5c273cb15c76172a2e2abdf
BLAKE2b-256 checksum
How to use checksums
73603a66272ed4e0026ce928cc5760cfec5056eb1cc9b23cbb2d55638ec72eff
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.0rc7-py3-none-any.whl

Download URL forge_mvc_i18n-1.0.0rc7-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fab2ab5d59705783677b053eebe9febc68608d34a8498586466215c029ad267
BLAKE2b-256 checksum
How to use checksums
57b2b9a5afe3aec1d24b396fa4ffc40f335e5d75d35f1d4b3f6137266ef8a40b
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