javascript - Django 1.2.3 - Internationalization - makemessages does not detect all strings -


one more question django concerning localization of javascript files.

django provides small , convenient javascript library used gettext internationalize strings in javascript files.

i set (at least interpolate function works) , generate po file french language. however, not strings detected. don't know why because same. couldn't find on django trac , official docs.

the javascript code in external file included in template , django apparently found because put 2 strings in po file.

the inclusion in html template :

<script src="{{media_url|default:'/media/'}}js/list.js" type="text/javascript"></script> 

the javascript code :

/* ---------------  * upload progress  * --------------- */ $(document).ready(function() {     $(function() {         $('#upload_form').uploadprogress({             //...              /* function called before starting upload */             start: function() {                 $("#upload_form").hide();                 filename = $("#id_file").val().split(/[\/\\]/).pop();                 fmts = gettext('uploading %(filename)s...');                 dat = {                     filename: filename                 };                 s = interpolate(fmts,dat,true);                 $("#progress_filename").html(s);                 $("#progress_container").show();             },              /* function called each time bar updated */             uploading: function(upload) {                 if (upload.percents >= 100) {                     window.cleartimeout(this.timer);                     fmts = gettext("saving %(filename)s...");                     dat = {                         filename: filename                     };                     s = interpolate(fmts,dat,true);                     $("#progress_filename").html(s);                 } else {                     fmts = gettext('uploading %(filename)s : %(percents)s%...');                     dat = {                         filename: filename,                         percents: upload.percents                     };                     s = interpolate(fmts,dat,true);                     $("#progress_filename").html(s);                 }             },              //...          });     }); });   /* --------------------  * confirmation dialogs  * -------------------- */ function delvid(title) {     fmts = gettext('do want delete video "%(title)s"?');     dat = {         title: title     };     s = interpolate(fmts,dat,true);     return confirm(s) }  function abortvid(title) {     fmts = gettext('do want abort processing of video "%(title)s"?');     dat = {         title: title     };     s = interpolate(fmts,dat,true);     return confirm(s) } 

the first part standard use of jquery.uploadprogress module jquery , second part 2 functions confirmation popups.

the detected strings both in first part :

  • 'uploading %(filename)s...'
  • 'saving %(filename)s...'

i used command "django-admin.py -d djangojs -l fr" , generated djangojs.po file these 2 strings. translated them. unfortunately, not translated @ runtime. seems have 2 problems finally.

any idea ?

django's javascript message parsing quite fragile. i've written details why so. have fix django 1.3 attached django ticket 7704. django may not accept patch, maybe can explain them why should? :)


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -