One more question about Django regarding localization of javascript files.
Django provides a small and handy javascript library that is used as gettext to internationalize strings in javascript files.
I installed it successfully (at least the interpolation function works) and I can generate a po file for the French language. However, not all rows are detected. I don’t know why, because they all look the same. I could not find anything on Django Trac and white papers.
The javascript code is in the external file included in the template, and Django apparently found it because it placed two lines in the po file.
Inclusion in the HTML template:
<script src="{{MEDIA_URL|default:'/media/'}}js/list.js" type="text/javascript"></script>
Javascript code:
$(document).ready(function() {
$(function() {
$('#upload_form').uploadProgress({
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();
},
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);
}
},
});
});
});
function delVid(title) {
fmts = gettext('Do you really want to delete the video "%(title)s"?');
dat = {
title: title
};
s = interpolate(fmts,dat,true);
return confirm(s)
}
function abortVid(title) {
fmts = gettext('Do you really want to abort the processing of the video "%(title)s"?');
dat = {
title: title
};
s = interpolate(fmts,dat,true);
return confirm(s)
}
- jquery.uploadprogress JQuery, - .
:
- '% (filename) s...'
- '% ( ) s...'
"django-admin.py -d djangojs -l fr", djangojs.po . . , . , .
?