Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I AM getting the following error:

ReferenceError: Can't find variable: gettext

I have added the following in my urls.py:

js_info_dict = { 'domain': 'djangojs', 'packages': ('my_project_name',), }
urlpatterns += patterns('', (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), )

I marked the string for localization as :

var lingualText = gettext("Are you sure you want to delete the photo?");  
var statusConfirm = confirm(lingualText);

I have added the following line in my template:

<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script>

To generate the language file for the text inside javascript file, I use the following command:

python /usr/bin/django-admin.py makemessages -d djangojs -l de

I am able to generate the djangojs.po file for the desired language. And I also get all the strings marked in the JS file. When I see the output in Firebug, I see the above error i.e.:

ReferenceError: Can't find variable: gettext

Can anybody tell me where am I going wrong? Am I having the problem with the path for jsi18n ?

Thanks in advance.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.