Fix in translations

This commit is contained in:
Antonio de la Rosa 2017-05-22 03:26:30 +02:00
parent 516b47a779
commit 4fc6e59885
2 changed files with 33 additions and 8 deletions

View file

@ -46,16 +46,26 @@ ${csrf_token("csrf_token")|n}
contentType: "application/x-www-form-urlencoded;charset=UTF-8", contentType: "application/x-www-form-urlencoded;charset=UTF-8",
success: function (data) { success: function (data) {
$('#send_text').show();
$('#saving').hide(); $('#saving').hide();
$('.flash').show();
//$('#container_translation').prepend("<div class=\"flash\" >${lang('admin', 'translation_saved_sucessfully', 'Translation saved sucessfully')}</div><script>setTimeout(function () { $(\".flash\").fadeOut(1000, function () { $('.flash').remove(); }); }, 3000);<\/script>");
setTimeout(function () { if(!data.error) {
$(".flash").fadeOut(1000) $('#send_text').show();
$('.flash').show();
}, 3000); setTimeout(function () {
$(".flash").fadeOut(1000)
}, 3000);
}
else
{
alert('Error: cannot update the translations');
}
}, },
error: function (data) { error: function (data) {

View file

@ -119,17 +119,32 @@ def admin(**args):
file_lang+="I18n.l['"+lang+"']['"+selected_module+"']['"+key+"']='"+I18n.l[lang][selected_module][key].replace("'", "\\'")+"'\n\n" file_lang+="I18n.l['"+lang+"']['"+selected_module+"']['"+key+"']='"+I18n.l[lang][selected_module][key].replace("'", "\\'")+"'\n\n"
""" """
error=0
if z>0: if z>0:
final_file='modules/'+selected_module+'/i18n/'+selected_module+'.py' final_file='modules/'+selected_module+'/i18n/'+selected_module+'.py'
old_file=''
with open(final_file, 'r') as f:
old_file=f.read()
f=open(final_file, 'w') f=open(final_file, 'w')
f.write(file_lang) try:
f.write(file_lang)
except:
f.write(old_file)
error=1
f.close() f.close()
return {'error': 0} return {'error': error}
return t.load_template('utils/translations.phtml', modules=module_final, selected_module=selected_module, form_module=form_module, arr_i18n_form=arr_i18n_form) return t.load_template('utils/translations.phtml', modules=module_final, selected_module=selected_module, form_module=form_module, arr_i18n_form=arr_i18n_form)