Django

Code

Ticket #5347 (closed: invalid)

Opened 8 months ago

Last modified 8 months ago

django does not look in the project-dir for a locale directory

Reported by: jumo@gmx.de Assigned to: nobody
Component: Tools Version: SVN
Keywords: i18n, internationalization, make-messages.py, compile-messages.py Cc:
Triage Stage: Unreviewed Has patch: 0
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description

hi,

maybe this is a copy but i couldn't find the "original".

i have a model like this:

from django.db import models
from django.utils.translation import ugettext_lazy as _

# Create your models here.
class Thing(models.Model):
        name = models.CharField(_('in model'),max_length=150)

        class Admin:
                pass

and in the root folder of my project (not my application) there is a conf/locale directory

after calling bin/make-messages.py in the root folder of my project there is a django.po like this:

julian@laptop:~/test/bug$ cat conf/locale/en-us/LC_MESSAGES/django.po 
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-09-06 09:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: thing/models.py:6
msgid "in model"
msgstr "in django.po"

after installing that app and calling bin/compile-messages.py the label in the admin-inteface for the name-field is "in model" and not, as i should be, "in django.po". there is no locale/... directory in my application directoy; the documentation reads:

First, it looks for a locale directory in the application directory of the view that’s being called. If it finds a translation for the selected language, the translation will be installed.

there isn't a locale directory in the application directory, so this step should take affect, but it doesn't:

Next, it looks for a locale directory in the project directory. If it finds a translation, the translation will be installed.

where (in the second quote) locale directory should be conf/locale directory, additionally.

Attachments

Change History

09/06/07 02:59:53 changed by anonymous

  • keywords set to i18n, internationalization, make-messages.py, complie-messages.py.
  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

09/06/07 03:10:23 changed by anonymous

  • keywords changed from i18n, internationalization, make-messages.py, complie-messages.py to i18n, internationalization, make-messages.py, compile-messages.py.

09/09/07 02:19:49 changed by anonymous

  • status changed from new to closed.
  • resolution set to invalid.

09/09/07 02:42:04 changed by Simon G. <dev@simon.net.nz>

  • status changed from closed to reopened.
  • resolution deleted.

Please don't do anonymous triage or close tickets without a reason.

09/16/07 15:26:40 changed by semenov

  • status changed from reopened to closed.
  • resolution set to invalid.

The documentation (http://www.djangoproject.com/documentation/i18n/#using-translations-in-your-own-projects) clearly says that application-level translations should be placed as $APPPATH/locale/<language>/LC_MESSAGES/django.(po|mo). This folder is then auto-discovered.

If you place your translation files at non-default location ($APPPATH/conf/locale/...), you should configure LOCALE_PATHS respectively.


Add/Change #5347 (django does not look in the project-dir for a locale directory)




Change Properties
Action