I have an application where users can fill a text field.
I would like "try" to translate it if the string that the user entered is in the .po
translation files.
So in one of my detail views, I did something like:
class InterrogationDetailView(generic.DetailView):
model = Interrogation
def get_context_data(self, **kwargs):
context = super(InterrogationDetailView, self)\
.get_context_data(**kwargs)
if self.object is not None:
context[u'translated_word'] = {
u'description': _(self.object.description),
}
return context
That's nice, it seems to work. So it searches in the .po
files. So I'd like to add sentences, or words on my own in those .po
files. When I try to add one translation that is not in my source files, when I call makemessages I get them commented like:
#~ msgid "I'm a test"
#~ msgstr "Godsmack - Cryin' like a b"
How to solve this? And if I'm not doing this the right way (I've read a lot about django translation), what is the way to go?