1

Versions:

  • Python 3.5.1
  • django 1.10
  • django-rosetta 0.7.13

I followed the rosetta tutorial. After creating some sentences to translate in a template using {% trans "sentence" %} (and {% load i18n %}), and running django-admin's makemessages and compilemessages, rosetta still cannot find anything to translate:

Nothing to translate!

You haven't specified any languages in your settings file, or haven't yet generated a batch of translation catalogs.

Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project.

Notes:

  • I had to solve some other bugs along the way. See here.
  • I looked in the locale folder and the .po and .mo files are there, and they look correct (i.e. have the sentences I made in the template). Here's the .po file.
# 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: 2017-06-13 13:31+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"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: templates/www/batch.html:8
msgid "(mother) and"
msgstr ""

#: templates/www/batch.html:8
msgid "(father)"
msgstr ""
  • I haven't used any fuzzy or laziness, except in one place needed to avoid an error (see below). But it didn't work before I did that either.
  • I tried adding the desired language to settings.py's LANGUAGES list. No effect, except I had to solve yet another bug.
  • I did add the LOCALE_PATHS suggested in this question.
  • I did restart the server a bunch of times.
  • I'm running the server via runserver (via PyCharm). Local development.

I can't think of or find anything more to try.

MrAlexBailey
  • 5,219
  • 19
  • 30
CoderGuy123
  • 6,219
  • 5
  • 59
  • 89
  • in which language you want translation? 'django-admin makemessages --all' use this for make other languages translation – Neeraj Kumar Jun 13 '17 at 16:42
  • The files are there already. It's not a problem with makemessages. – CoderGuy123 Jun 14 '17 at 17:19
  • I managed to solve the issue in that eventually my translations started appearing under third party. However, I have no idea what was the causal factor, so I can't answer my question. – CoderGuy123 Jun 24 '17 at 15:48

1 Answers1

0

This worked for me:

  1. create locale directory in project root

  2. run django-admin makemessages -l fa -i myenv