On Nov 19, 12:10 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-11-18 at 20:51 -0800, davidynamic wrote:
> > I have some *.js files in an external folder that I'm importing into
> > my application that already has working translation.
>
> > But whenever i add gettext('somestring') to these external *.js files
> > it breaks them
>
Sorry. about the ambiguity, running on little sleep. Thanks for
responding.
I mean the javascript won't work because the portion of the page
generated by this javascript file won't even load.
> > the
>
> > (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
>
> > regular expression is in the url file of my main application
>
> > I'm getting these files through an "include" in this url file
>
> I don't understand what this sentence means. Which files? Could you
> cut-and-paste a very short example of what you are actually doing?
That regular expression is in the urls.py file of my project folder
like this
js_info_dict = {
'packages': ('chide.feedback.surveys',),
}
urlpatterns = patterns('',
(r'^demo/', 'django.views.generic.simple.direct_to_template',
{
'template': 'survey_demo.html'
}),
...
(r'^i18n/', include('django.conf.urls.i18n')),
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
)
As I understand, the (r^jsi18n... (bottom) regular expresssion should
allow me to use the gettext('somestring') inside any .js file or
inside the javascript portion of a template file that is in my
urlpatterns
The template file survey_demo.html at the top references an external
*.js file.
When I place a gettext("") function inside the *.js file, it stops
working
to be precise I'm trying to translate this string...
emptyPageContent: '<ol class="page"><li class="placeholder">'
+ 'You haven\'t added any questions yet. To get started, drag a
question '
+ 'from the left panel onto this area right here.</li></ol>',
by doing this..
emptyPageContent: '<ol class="page"><li class="placeholder">'
+ gettext('You haven\'t added any questions yet. To get started,
drag a question ')
+ gettext('from the left panel onto this area right here.')
+ '</li></ol>',
Thanks for your help
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django I18N" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Django-I18N?hl=en
-~----------~----~----~----~------~----~------~--~---