Code

Opened 6 years ago

Last modified 5 months ago

#6376 new New feature

Please don't force the usage of the 'django' gettext domain

Reported by: dennis@… Owned by: nobody
Component: Internationalization Version: master
Severity: Normal Keywords: gettext
Cc: clouserw@…, fwenzel, 4glitch@…, raymond.penners@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I'm using django as a library in my non-web-based application. As such I prefer not to use the 'django' gettext domain but my own. I currently work around it with some symlinking trickery since being compatible with upstream django is more important than not having workarounds, but it would be great if django supported this. To illustrate what I mean, I've attached a simple and untested patch against current svn (rev 7020).

Attachments (1)

gettext_domain.patch (1.7 KB) - added by dennis@… 6 years ago.
SImple and untested patch

Download all attachments as: .zip

Change History (16)

Changed 6 years ago by dennis@…

SImple and untested patch

comment:1 Changed 6 years ago by Bastian Kleineidam <calvin@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

If you change the domain you also have to rename django.mo, which I think is awkward.
You could use gettext.translation('django') for django-related strings and gettext.translation('yourapp') for other strings. This way your translations are separate and don't interfere with the django ones.

comment:2 Changed 6 years ago by anonymous

That doesn't work for my use case: template strings with {% trans %}/{% blocktrans %}. I'm using the django db/model api and templating system, nothing else. So no translated strings from django are being used, but the translation infrastructure is.

comment:3 Changed 6 years ago by Simon Greenhill <dev@…>

  • Has patch set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Design decision needed

comment:4 Changed 6 years ago by mtredinnick

I don't think the proposed solution is the right approach. It is best practice that the translation domain for a library or reusable component does not change, that way it is shared between all apps that want to use it. I'd prefer to see a way to specify additional translation domains, since that will allow different apps to ship in different domains.

That might be an extra template tag or something, I'm not sure. It's better than a setting, which isn't something application authors will know about -- it's in the control of the user/installer -- so they won't be able to create appropriate translation files. Application authors must be able to create PO files in their applications and users of those applications must be able to use them, so a setting can't work.

comment:5 Changed 6 years ago by mtredinnick

  • Triage Stage changed from Design decision needed to Someday/Maybe

comment:6 Changed 4 years ago by clouserw

  • Cc clouserw@… added

comment:7 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:8 Changed 3 years ago by julien

  • Needs tests set

comment:9 Changed 3 years ago by fwenzel

  • Cc fwenzel added
  • Easy pickings unset

comment:10 Changed 3 years ago by fwenzel

  • Easy pickings set

sorry, didn't mean to unset "easy pickings".

comment:11 Changed 3 years ago by jezdez

  • Easy pickings unset

Yeah, you didn't unset it, it simply didn't have any value.

comment:12 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:13 Changed 13 months ago by ramiro

  • Triage Stage changed from Someday/Maybe to Accepted

#20070 asked for the same feature and was accepted by Jacob.

comment:14 Changed 11 months ago by 4glitch@…

  • Cc 4glitch@… added

comment:15 Changed 5 months ago by pennersr

  • Cc raymond.penners@… added

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.