1
1

Hi,

some OSQA error messages are directly hardcoded in python scripts like the following sample:

 raise forms.ValidationError(_('please use following characters in tags: letters , numbers, and characters \'.-_\''))

There is an entry in djongo.po for the above sample:

#: forum/forms/qanda.py:101
msgid ""
"please use following characters in tags: letters , numbers, and characters "
"'.-_'"
msgstr ""

As you can see msgid is empty. The error message is coming directly from qandy.py. How can I translate these kind of error messages? I need to use unicode characters. Saving the qanda.py as UNICODE file craches OSQA.

Thank you for your help.

asked 15 Feb, 03:07

coolio74's gravatar image

coolio74
1622
accept rate: 0%

edited 20 Feb, 01:02

Jordan's gravatar image

Jordan ♦♦
3.1k618


'msgid' is not empty. it's contents follows till the 'msgstr' string

the following will be a correct translation:

#: forum/forms/qanda.py:101 msgid "" "please use following characters in tags: letters , numbers, and characters " "'.-_'" msgstr "" "your translation blabla: blabla1 , blabla2, and blabla3 " "'.-_'"

link

answered 26 Feb, 17:20

egorych's gravatar image

egorych
114
accept rate: 0%

This threw me too when I first picked up OSQA - I've never worked w/ Django before. There are some hardcoded strings in the application, but this isn't one of them. When using Django's i18n support, you provide the default string value which becomes both the display string and the message id. That way you don't have to manage separate message identifiers and separate translations and you see the actual message in code.

If this were a hardcoded string, that innocent looking underscore and parenthesis wouldn't be required. Take a look at the imports:

from django.utils.translation import ugettext as _

The msgid isn't actually empty, multi-line translations start with an empty string like this. Just enter a value for msgstr. See the Django Book for more - Chapter 18: Internationalization

link

answered 27 Feb, 05:19

Danny%20Thomas's gravatar image

Danny Thomas
7651014
accept rate: 40%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×38

Asked: 15 Feb, 03:07

Seen: 371 times

Last updated: 27 Feb, 05:19

powered by OSQA