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

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

Built distribution (wheel)

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

Total release size: 36.7 kB

Release files / forge_mvc_i18n-1.0.0rc9.tar.gz

Download URL forge_mvc_i18n-1.0.0rc9.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9014ef896782f9aa24ffc39a8975ad4f556f4a040878b064e84c0b5cd2370717
BLAKE2b-256 checksum
How to use checksums
1338c5b25fa5c14917256e4cf5193a4c0dc379a19ef80a8e45aa5f070eb48a01
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.0rc9-py3-none-any.whl

Download URL forge_mvc_i18n-1.0.0rc9-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31431602f4dbf78d90ba8831ac668fdf7fdee4ce7b23a8a78f96b21ecd81025e
BLAKE2b-256 checksum
How to use checksums
e1244005d0a3515192e20f28ff3a2b0dbd5e987ef93d257f47c39e968b730c8a
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