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 ### Translations
loadlang(LANGUAGE); loadlang(LANGUAGE);
global $LANG; global $LANG,$JSLANG;
### Security ### Security
testip(); testip();
logprotect(); logprotect();
### Sessions ### Sessions
session_name(markdoc); session_name('markdoc');
session_start(); session_start();
/*var_dump($_POST); /*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/emoji.min.js"></script>
<script type="text/javascript" src="/js/toc.bundle.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" 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"> <?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/simplemde.min.css">
<script src="/js/simplemde.min.js"></script> <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>'); ?> <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 external = RegExp('^((f|ht)tps?:)?//');
var javascript = RegExp('^javascript:'); var javascript = RegExp('^javascript:');
var emoji; var emoji;
var LANG;
$(function(){ $(function(){
$("#files").jstree({ $("#files").jstree({
themes: { responsive: true }, themes: { responsive: true },
plugins: [ "types" ], plugins: [ "types" ],
core: core:
{ {
strings:{ loading: "Chargement" }, strings:{ loading: LANG['LOADING'] },
check_callback: true, check_callback: true,
data : { data : {
type: "POST", type: "POST",
@ -75,7 +76,7 @@ function openlink(dest,majtree)
if (dest!="special/404.md") if (dest!="special/404.md")
openlink("special/404.md",false); openlink("special/404.md",false);
else 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") if (dest!="special/404.md")
openlink("special/404.md",false); openlink("special/404.md",false);
else 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" ], plugins: ["contextmenu", "dnd" ],
core: core:
{ {
strings:{ loading: "Chargement" }, strings:{ loading: LANG['LOADING'] },
check_callback: true, check_callback: true,
data : { data : {
type: "POST", type: "POST",
@ -77,7 +77,7 @@ $(function(){
preview.innerHTML = emoji.replace_colons(this.parent.markdown(plainText)); preview.innerHTML = emoji.replace_colons(this.parent.markdown(plainText));
Prism.highlightAll(); Prism.highlightAll();
}.bind(this), 1) }.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","|", 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]); alertBox(data[1], data[0]);
}, },
error: function(XMLHttpRequest, textStatus, errorThrown) { error: function(XMLHttpRequest, textStatus, errorThrown) {
alertBox('Erreur AJAX !','danger'); alertBox(LANG['AJAXERROR'],'danger');
} }
}); });
} }
else else
alertBox('Erreur de sélection !', 'danger'); alertBox(LANG['SELECTERROR'], 'danger');
}); });
$("#files").on("select_node.jstree", function (e, nodes) { $("#files").on("select_node.jstree", function (e, nodes) {
@ -174,7 +174,7 @@ $(function(){
if ($("#files").jstree("is_leaf",nodes.node)) if ($("#files").jstree("is_leaf",nodes.node))
editlink(file); editlink(file);
else else
alertBox('Fonction non implémentée !','danger'); alertBox(LANG['NOTCODED'],'danger');
}); });
$("input[name=submit]").click(function(e) { $("input[name=submit]").click(function(e) {
@ -239,7 +239,7 @@ function openlink(dest,majtree)
if (dest!="special/404.md") if (dest!="special/404.md")
openlink("special/404.md",true); openlink("special/404.md",true);
else 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; editfile=dest;
}, },
error: function(XMLHttpRequest, textStatus, errorThrown) { 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") if (dest!="special/404.md")
openlink("special/404.md",true); openlink("special/404.md",true);
else 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) function loadlang($language)
{ {
global $LANG; global $LANG,$JSLANG;
$LANG=json_decode(file_get_contents(ROOT_DIR."lang/".$language.".json"),true); $JSLANG=file_get_contents(ROOT_DIR."lang/".$language.".json");
$LANG=json_decode($JSLANG,true);
} }
function history($file) function history($file)