Some translations
This commit is contained in:
parent
20688e43b8
commit
384f0b0bd9
|
@ -522,15 +522,23 @@ class translations{
|
|||
}
|
||||
|
||||
public function translate($string){
|
||||
bdump($string);
|
||||
try {
|
||||
$this->filename = "translations/".$this->language."/".pathinfo(array_reverse(debug_backtrace())[0]['file'])['basename'];
|
||||
$file_infos = pathinfo(array_reverse(debug_backtrace())[0]['file']);
|
||||
if(strpos($file_infos['dirname'], 'risorse') !== false) {
|
||||
$this->filename = "../../translations/".$this->language."/".$file_infos['basename'];
|
||||
} else {
|
||||
$this->filename = "translations/".$this->language."/".$file_infos['basename'];
|
||||
}
|
||||
if (!file_exists($this->filename))
|
||||
throw new Exception ('file does not exist');
|
||||
$this->loaded_translations = require($this->filename);
|
||||
$this->loaded_translations = array_merge(require($this->filename),require("translations/".$this->language."/base.php"));
|
||||
if (!in_array($string, $this->loaded_translations))
|
||||
throw new Exception ('string does not exist');
|
||||
return $this->loaded_translations[$string];
|
||||
} catch (\Exception $e) {
|
||||
bdump($this->filename);
|
||||
bdump($e, $string);
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
@ -549,4 +557,13 @@ function init_class(){
|
|||
//} else {
|
||||
//Debugger::enable(Debugger::PRODUCTION, __DIR__ . '/error-log');
|
||||
//}
|
||||
}
|
||||
|
||||
function t($string, $echo=true){
|
||||
global $translations;
|
||||
if($echo){
|
||||
echo $translations->translate($string);
|
||||
} else {
|
||||
return $translations->translate($string);
|
||||
}
|
||||
}
|
|
@ -40,8 +40,8 @@ th, td {
|
|||
<div style="overflow-x:auto;">
|
||||
<table style="width: 90%; text-align:center;">
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>avaible</th>
|
||||
<th><?php t("Name"); ?></th>
|
||||
<th><?php t("Avaible"); ?></th>
|
||||
<?php
|
||||
foreach($risultato as $row){
|
||||
if(!in_array($row['name'], $hidden)){
|
||||
|
|
|
@ -38,14 +38,14 @@ th, td {
|
|||
<div style="overflow-x:auto;">
|
||||
<table style="width: 90%; text-align:center;">
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>avaible</th>
|
||||
<th>Autista</th>
|
||||
<th>Chiama</th>
|
||||
<th>Scrivi</th>
|
||||
<th>Interventi</th>
|
||||
<th>Minuti Disponibilità</th>
|
||||
<th>Altro</th>
|
||||
<th><?php t("Name"); ?></th>
|
||||
<th><?php t("Avaible"); ?></th>
|
||||
<th><?php t("Driver"); ?></th>
|
||||
<th><?php t("Call"); ?></th>
|
||||
<th><?php t("Write"); ?></th>
|
||||
<th><?php t("Services"); ?></th>
|
||||
<th><?php t("Minuti Disponibilità"); ?></th>
|
||||
<th><?php t("Other"); ?></th>
|
||||
<?php
|
||||
foreach($risultato as $row){
|
||||
if(!in_array($row['name'], $hidden) OR in_array($user->name(), $hidden)){
|
||||
|
|
|
@ -337,13 +337,13 @@
|
|||
{% block menu %}
|
||||
<!-- Menu -->
|
||||
<div class="topnav" id="myTopnav">
|
||||
<a href="{{ urlsoftware }}lista.php" class="active">Lista Disponibilità</a>
|
||||
<a href="{{ urlsoftware }}interventi.php">Interventi</a>
|
||||
<a href="{{ urlsoftware }}esercitazioni.php">Esercitazioni</a>
|
||||
<a href="{{ urlsoftware }}log.php">Log</a>
|
||||
<a {# href="{{ urlsoftware }}grafici.php" #}>Grafici</a>
|
||||
{% if enable_technical_support %}<a href="javascript:void(0);" onclick="chat()">Supporto tecnico</a>{% endif %}
|
||||
<a style="float: right;" id="logout">Ciao {{ user.name }}. <b onclick="location.href='{{ urlsoftware }}logout.php';">exec il logout</b></a>
|
||||
<a href="{{ urlsoftware }}lista.php" class="active">{{ 'Availability List'|t }}</a>
|
||||
<a href="{{ urlsoftware }}interventi.php">{{ 'Services'|t }}</a>
|
||||
<a href="{{ urlsoftware }}esercitazioni.php">{{ 'Trainings'|t }}</a>
|
||||
<a href="{{ urlsoftware }}log.php">{{ 'Logs'|t }}</a>
|
||||
<a {# href="{{ urlsoftware }}grafici.php" #}>{{ 'Graphics'|t }}</a>
|
||||
{% if enable_technical_support %}<a href="javascript:void(0);" onclick="chat()">{{ 'Technical Support' }}</a>{% endif %}
|
||||
<a style="float: right;" id="logout">{{ 'Hi, %s.'|t|format(user.name) }} <b onclick="location.href='{{ urlsoftware }}logout.php';">{{ 'Logout'|t }}</b></a>
|
||||
<a href="javascript:void(0);" class="icon" onclick="myFunction()">☰</a>
|
||||
</div>
|
||||
<!-- /Menu -->
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<img alt="VVF" src="./risorse/images/owner.png" width="150" style="display: block; margin-left: auto; margin-right: auto;">
|
||||
<br>
|
||||
<p style="text-align: center;">
|
||||
<a id='add' href="modifica_esercitazione.php?add">add esercitazione</a>
|
||||
<a id='add' href="modifica_esercitazione.php?add">{{ 'Add training'|t }}</a>
|
||||
</p>
|
||||
<br>
|
||||
<div id="lista"></div>
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
<img alt="VVF" src="./risorse/images/owner.png" width="150" style="display: block; margin-left: auto; margin-right: auto;">
|
||||
<br>
|
||||
<p style="text-align: center;">
|
||||
<a id='add' href="modifica_intervento.php?add">add intervento</a>
|
||||
<a id='add' href="modifica_intervento.php?add">{{ 'Add service'|t }}</a>
|
||||
</p>
|
||||
<br>
|
||||
<div id="lista"></div>
|
||||
<script>
|
||||
$.get( "risorse/ajax/ajax_interventi.php", function( data ) {
|
||||
$( "#lista" ).html( data );
|
||||
console.log( "Caricato lista." );
|
||||
console.log( "List loaded." );
|
||||
});
|
||||
$(document).ready(function() {
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
dispo: 1
|
||||
},
|
||||
success: function(data) {
|
||||
alert("Grazie, {{ user.name }}, hai dato la tua disponibilità in caso in allerta.");
|
||||
alert("{{ 'Thanks, %s, you have given your availability in case of alert.'|t|format(user.name) }}");
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
@ -33,7 +33,7 @@
|
|||
dispo: 0
|
||||
},
|
||||
success: function(data) {
|
||||
alert("Grazie {{ user.name }}, hai dato la tua disponibilità in caso in allerta.");
|
||||
alert("{{ 'Thanks, %s, you have removed your availability in case of alert.'|t|format(user.name) }}");
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
// Translated by: Name Surname (github, email or another social profile url/username)
|
||||
|
||||
return [
|
||||
"Name" => "Name",
|
||||
"Avaible" => "Avaible"
|
||||
];
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
// Translated by: Name Surname (github, email or another social profile url/username)
|
||||
|
||||
return [
|
||||
"Name" => "Name",
|
||||
"Avaible" => "Avaible",
|
||||
"Driver" => "Driver",
|
||||
"Call" => "Call",
|
||||
"Write" => "Write",
|
||||
"Services" => "Services",
|
||||
"Minuti Disponibilità" => "Minuti Disponibilità",
|
||||
"Other" => "Other"
|
||||
];
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
// Translated by: Name Surname (github, email or another social profile url/username)
|
||||
|
||||
return [
|
||||
"Availability List" => "Availability List",
|
||||
"Services" => "Services",
|
||||
"Trainings" => "Trainings",
|
||||
"Logs" => "Logs",
|
||||
"Graphics" => "Graphics",
|
||||
"Technical Support" => "Technical Support",
|
||||
"Hi, %s." => "Hi, %s.",
|
||||
"Logout" => "Logout"
|
||||
];
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
// Translated by: Name Surname (github, email or another social profile url/username)
|
||||
|
||||
return [
|
||||
"Add training" => "Add training"
|
||||
];
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
// Translated by: Name Surname (github, email or another social profile url/username)
|
||||
|
||||
return [
|
||||
"Add service" => "Add service"
|
||||
];
|
|
@ -4,5 +4,7 @@
|
|||
return [
|
||||
"Are you avaible in case of alert?" => "Are you avaible in case of alert?",
|
||||
"Active" => "Active",
|
||||
"Not Active" => "Not Active"
|
||||
"Not Active" => "Not Active",
|
||||
"Thanks, %s, you have given your availability in case of alert." => "Thanks, %s, you have given your availability in case of alert.",
|
||||
"Thanks, %s, you have removed your availability in case of alert." => "Thanks, %s, you have removed your availability in case of alert."
|
||||
];
|
||||
|
|
|
@ -15,6 +15,7 @@ $twig = new \Twig\Environment($loader, [
|
|||
//'cache' => 'compilation'
|
||||
]);
|
||||
$twig->addFilter($filter);
|
||||
|
||||
$template = NULL;
|
||||
function loadtemplate($templatename, $data, $requirelogin=true){
|
||||
global $database, $user, $twig, $template;
|
||||
|
|
Loading…
Reference in New Issue