Opened 7 years ago

Closed 7 years ago

#5347 closed (invalid)

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

Reported by: jumo@… Owned by: nobody
Component: Tools Version: master
Severity: Keywords: i18n, internationalization, make-messages.py, compile-messages.py
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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.

Change History (5)

comment:1 Changed 7 years ago by anonymous

  • Keywords i18n internationalization make-messages.py complie-messages.py added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by anonymous

  • Keywords compile-messages.py added; complie-messages.py removed

comment:3 Changed 7 years ago by anonymous

  • Resolution set to invalid
  • Status changed from new to closed

comment:4 Changed 7 years ago by Simon G. <dev@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened

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

comment:5 Changed 7 years ago by semenov

  • Resolution set to invalid
  • Status changed from reopened to closed

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.

Note: See TracTickets for help on using tickets.
Back to Top