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

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

Built distribution (wheel)

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

Total release size: 11.1 kB

Release files / forge_mvc_i18n-1.0.0rc6.tar.gz

Download URL forge_mvc_i18n-1.0.0rc6.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
854d48fd36fab6319d2cf73594e3bb3ad0641ba13dc0b4325cdb8a6370cd5bb8
BLAKE2b-256 checksum
How to use checksums
0cfb5b5681613f17d34be5678a886c9c8fab875faa924678a5e5b19dfb8d3c34
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.0rc6-py3-none-any.whl

Download URL forge_mvc_i18n-1.0.0rc6-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20708e8f85019194824f7b7d22a7080d926fe26ffb2d39db916c55b3747ec7ab
BLAKE2b-256 checksum
How to use checksums
8f13cb21f6441e939cc754b5ee2a8a96c527ecebdbcc967ae9c9e12ca036ba4e
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