Javascript translation OK

This commit is contained in:
Nicolas Hordé 2021-01-03 14:32:47 +01:00
parent ed15b416a9
commit 2ae134226a
4 changed files with 20 additions and 15 deletions

View File

@ -26,14 +26,14 @@ include LIB_DIR."/functions.php";
### Translations
loadlang(LANGUAGE);
global $LANG;
global $LANG,$JSLANG;
### Security
testip();
logprotect();
### Sessions
session_name(markdoc);
session_name('markdoc');
session_start();
/*var_dump($_POST);
@ -223,6 +223,9 @@ print(($_SESSION['md_admin'] == true)?'<li class="nav-item dropdown">
<script type="text/javascript" src="/js/emoji.min.js"></script>
<script type="text/javascript" src="/js/toc.bundle.js"></script>
<script type="text/javascript" src="/js/magnifik.js"></script>
<script type="text/javascript">
var LANG = <?php echo $JSLANG; ?>
</script>
<?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/simplemde.min.css">
<script src="/js/simplemde.min.js"></script>
<script type="text/javascript" src="/js/functionsadmin.js"></script>':'<script type="text/javascript" src="/js/functions.js"></script>'); ?>

View File

@ -10,13 +10,14 @@
var external = RegExp('^((f|ht)tps?:)?//');
var javascript = RegExp('^javascript:');
var emoji;
var LANG;
$(function(){
$("#files").jstree({
themes: { responsive: true },
plugins: [ "types" ],
core:
{
strings:{ loading: "Chargement" },
strings:{ loading: LANG['LOADING'] },
check_callback: true,
data : {
type: "POST",
@ -75,7 +76,7 @@ function openlink(dest,majtree)
if (dest!="special/404.md")
openlink("special/404.md",false);
else
$("#content").html("<b>Erreur 404 sur erreur 404: pas de /special/404.md !");
$("#content").html("<b>"+LANG['404X2']+"</b>");
}
});
}
@ -173,7 +174,7 @@ function search(arg)
if (dest!="special/404.md")
openlink("special/404.md",false);
else
$("#content").html("<b>Erreur 404 sur erreur 404: pas de /special/404.md !");
$("#content").html("<b>"+LANG['404X2']+"</b>");
}
});
}

View File

@ -56,7 +56,7 @@ $(function(){
plugins: ["contextmenu", "dnd" ],
core:
{
strings:{ loading: "Chargement" },
strings:{ loading: LANG['LOADING'] },
check_callback: true,
data : {
type: "POST",
@ -77,7 +77,7 @@ $(function(){
preview.innerHTML = emoji.replace_colons(this.parent.markdown(plainText));
Prism.highlightAll();
}.bind(this), 1)
return "Chargement..."
return LANG['LOADING']
},
toolbar: ["bold","italic","strikethrough","|","heading-1","heading-2","heading-3","|","quote","unordered-list","ordered-list","horizontal-rule","|",
{
@ -161,12 +161,12 @@ $(function(){
alertBox(data[1], data[0]);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alertBox('Erreur AJAX !','danger');
alertBox(LANG['AJAXERROR'],'danger');
}
});
}
else
alertBox('Erreur de sélection !', 'danger');
alertBox(LANG['SELECTERROR'], 'danger');
});
$("#files").on("select_node.jstree", function (e, nodes) {
@ -174,7 +174,7 @@ $(function(){
if ($("#files").jstree("is_leaf",nodes.node))
editlink(file);
else
alertBox('Fonction non implémentée !','danger');
alertBox(LANG['NOTCODED'],'danger');
});
$("input[name=submit]").click(function(e) {
@ -239,7 +239,7 @@ function openlink(dest,majtree)
if (dest!="special/404.md")
openlink("special/404.md",true);
else
$("#content").html("<b>Erreur 404 sur erreur 404: pas de /special/404.md !");
$("#content").html("<b>"+LANG['404X2']+"</b>");
}
});
}
@ -329,7 +329,7 @@ function editlink(dest)
editfile=dest;
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alertBox('Erreur AJAX', 'danger');
alertBox(LANG['AJAXERROR'], 'danger');
}
});
}
@ -361,7 +361,7 @@ function search(arg)
if (dest!="special/404.md")
openlink("special/404.md",true);
else
$("#content").html("<b>Erreur 404 sur erreur 404: pas de /special/404.md !");
$("#content").html("<b>"+LANG['404X2']+"</b>");
}
});
}

View File

@ -157,8 +157,9 @@ function searchstr($path, $string){
function loadlang($language)
{
global $LANG;
$LANG=json_decode(file_get_contents(ROOT_DIR."lang/".$language.".json"),true);
global $LANG,$JSLANG;
$JSLANG=file_get_contents(ROOT_DIR."lang/".$language.".json");
$LANG=json_decode($JSLANG,true);
}
function history($file)