django-rosetta translated phrases not appearing on pages

1.8k Views Asked by At

I've got a bunch of strings marked for translation in my python code.

For example:

remarks_sample = forms.CharField(
label = _('Remarks'),
widget = forms.Textarea(attrs = {
        'placeholder': _("Remarks"),
    })
)

I've successfully ran django-admin.py makemessages and translated the phrases in Rosetta admin. I'm trying to figure out why the translated phrases arn't showing up on my pages.

2

There are 2 best solutions below

0
On BEST ANSWER

Were the files actually written to by django-rosetta? If Rosetta can't write the content back to the .po files (e.g. because they are not writable by the web server process) it'll just keep them in memory (you can download your translations, and replace the files.)

Also, you can run django-admin.py compilemessages to explicitly compile the updated .po files into .mo files, which are read by Django, before restarting the webserver.

Also, is _ aliased to ugettext or ugettext_lazy? It should probably be the latter.

2
On

If you are using development server you would have to restart it as it would not detect updated translations itself.

If you are on production server, you probably want to tell rosetta to auto reload (see: Rosetta Configuration).