Bonsoir,
Je me penche actuellement sur l'internationalisation d'une petite application

donc comme tout à chacun j'ai utilisé django-admin.py makemessages comme suit

django-admin.py makemessages -l fr_FR --all

Et obtenu le message d'erreur:

Error: This script should be run from the Django SVN tree or your project or app tree. If you did indeed run it from the SVN checkout or your project or application, maybe you are just missing the conf/locale (in the django tree) or locale (for project and application) directory? It is not created automatically, you have to create it by hand if you want to enable i18n for your project or application.

Donc comme la doc le dit ici
https://docs.djangoproject.com/en/1.4/topics/i18n/translation/#how-django-discovers-translations

j'ai fait un mkdir locale dans le dossier de mon application (c'est l'explication du point 2 de ce paragraphe) puis retapé

django-admin.py makemessages -l fr_FR --all

Et tout a été généré correctement. j'ai donc pu faire ce que je voulais puis compiler (pour produire le .mo)

Le problème enfin :

Quand j'accède à mes pages, rien n'est traduit, extrait du template :
{% load i18n %}
{% trans "Name" %}

Là où je suis perdu c'est que django-admin trouve bien le path pour générer les fichiers de langue mais l'appli depuis le navigateur, pas du tout.

Tout ce que j'ai trouvé comme workaround c'est de définir LOCALE_PATHS .

Mais je suis dubitatif sur les explications du point 2 de https://docs.djangoproject.com/en/1.4/topics/i18n/translation/#how-django-discovers-translations

Quelqu'un pourrait il m'expliquer ce que j'aurai loupé et qui serait sous mes yeux ? :)

Merci

Cordialement.


_______________________________________________
django mailing list
[email protected]
http://lists.afpy.org/mailman/listinfo/django

Répondre à