Code

Opened 4 years ago

Closed 3 years ago

#13451 closed (fixed)

i18n - explain use of LOCALE_PATHS for translations outside of project root and apps

Reported by: dmarble Owned by: nobody
Component: Documentation Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I scratched my head for a while trying to figure out how to include compiled translations from a directory that is not part of the usual translation traversal, i.e. <project root>/locale and each <app>/locale directory.

I ended up stepping through code for a while to find out that trans_real.py searches for LOCALE_PATHS, a tuple/list that can be explicitly defined in settings.py with extra locale directories for use in translation.

This is important where templates may be kept separately from apps and outside of the main project root folder. For example, in pinax, apps are kept in a separate folder which is referenced in a new project based on pinax, but the templates for those external apps are in the main pinax/ project directory.

An example could be added describing this situation in the translation / i18n documentation pages.

For example:

LOCALE_PATHS = (
    '/path/to/external/locale',
)

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by russellm

  • milestone 1.2 deleted
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

LOCALE_PATHS is mentioned in the settings page, and in the i18n howto; however, neither of these sources are prominently linked from the main i18n docs. There is definitely room for improvement here.

However, I'm taking this off the 1.2 milestone because there is still some drafting effort required. If someone works up an appropriate documentation patch, feel free to bump back to 1.2.

comment:2 Changed 3 years ago by ramiro

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

Fixed in r15441.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.