Commit d1096192 authored by David's avatar David

V 4.0.1

    Ajout début traduction NL & TR
    Campagne de don #21
    URL rewriting pour lang
parent 45ae3748
......@@ -2,5 +2,14 @@
RewriteEngine on
RewriteRule ^Autonome.php$ index.php [L]
RewriteRule ^StandAlone.php$ index.php [L]
#RewriteBase /
RewriteRule ^Autonome.php$ index.php?langue=fr&%{QUERY_STRING} [L]
RewriteRule ^StandAlone.php$ index.php?langue=en&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]{2})(.*) index.php?langue=$1&%{QUERY_STRING}
......@@ -7,7 +7,7 @@
<p><?= _('To calculate the dimensions of an autonomous solar installation, consider that it is wintertime (longer lighting time needed, but the fridge might be unplugged due to low temperature outside...)') ?> :</p>
<ul>
<li><a href="http://conso.calcpv.net/?EquiNom1=Ordinateur%20Portable&EquiPuis1=45&EquiNb1=1&EquiUti1=6&EquiPmax1=1&EquiNom2=Aspirateur%20Classe%20A&EquiPuis2=700&EquiNb2=1&EquiUti2=0.25&EquiNom3=Ampoule%20Led&EquiPuis3=7&EquiNb3=4&EquiUti3=7&EquiNom4=Machine%20%C3%A0%20coudre&EquiPuis4=100&EquiNb4=1&EquiUti4=0.5&EquiNom5=Mini%20cha%C3%AEne%20(musique)&EquiPuis5=16&EquiNb5=1&EquiUti5=6&EquiPmax5=1&EquiNom6=Recharge%20t%C3%A9l%C3%A9phone%20portable&EquiPuis6=6&EquiNb6=1&EquiUti6=2&EquiPmax6=1&EquiNom7=Pompe%20immerg%C3%A9e&EquiPuis7=400&EquiNb7=1&EquiUti7=0.5&EquiPmax7=1&&p=CalcConsommation&equiIncrement=7"><?= _('First sober example') ?></a></li>
<li><a href="http://conso.calcpv.net/?EquiNom1=Aspirateur%20Classe%20A&EquiPuis1=700&EquiNb1=1&EquiUti1=0.25&EquiPmax1=1&EquiNom2=Cong%C3%A9lateur%20Bahut%20200L%20Classe%20A&EquiPuis2=370&EquiNb2=1&EquiUti2=24&EquiTotalInput2=800&EquiPmax2=1&EquiNom3=Ampoule%20%C3%A0%20incandescence&EquiPuis3=75&EquiNb3=3&EquiUti3=8&EquiPmax3=1&EquiNom4=Ordinateur%20de%20bureau%20+%20%C3%A9cran&EquiPuis4=140&EquiNb4=1&EquiUti4=0&EquiNom5=T%C3%A9l%C3%A9phone%20fixe&EquiPuis5=2&EquiNb5=1&EquiUti5=24&EquiTotalInput5=48&EquiPmax5=1&EquiNom6=Box%20Internet&EquiPuis6=20&EquiNb6=1&EquiUti6=24&EquiTotalInput6=480&EquiPmax6=1&EquiNom7=T%C3%A9l%C3%A9&EquiPuis7=70&EquiNb7=1&EquiUti7=0&EquiPmax7=1&EquiNom8=Rasoir&EquiPuis8=5&EquiNb8=1&EquiUti8=0.08&&p=CalcConsommation&from=CalcPvAutonome&equiIncrement=8"><?= _('Second example') ?></a></li>
<li><a href="http://conso.calcpv.net/?EquiNom1=Aspirateur%20Classe%20A&EquiPuis1=700&EquiNb1=1&EquiUti1=0.25&EquiPmax1=1&EquiNom2=Cong%C3%A9lateur%20Bahut%20200L%20Classe%20A&EquiPuis2=370&EquiNb2=1&EquiUti2=24&EquiTotalInput2=800&EquiPmax2=1&EquiNom3=Ampoule%20%C3%A0%20incandescence&EquiPuis3=75&EquiNb3=3&EquiUti3=8&EquiPmax3=1&EquiNom4=Ordinateur%20de%20bureau%20+%20%C3%A9cran&EquiPuis4=140&EquiNb4=1&EquiUti4=0&EquiNom5=T%C3%A9l%C3%A9phone%20fixe&EquiPuis5=2&EquiNb5=1&EquiUti5=24&EquiTotalInput5=48&EquiPmax5=1&EquiNom6=Box%20Internet&EquiPuis6=20&EquiNb6=1&EquiUti6=24&EquiTotalInput6=480&EquiPmax6=1&EquiNom7=T%C3%A9l%C3%A9&EquiPuis7=70&EquiNb7=1&EquiUti7=0&EquiPmax7=1&EquiNom8=Rasoir&EquiPuis8=5&EquiNb8=1&EquiUti8=0.08&&p=CalcConsommation&equiIncrement=8"><?= _('Second example') ?></a></li>
</ul>
<form>
<table>
......
......@@ -855,7 +855,7 @@ if (isset($_GET['submit'])) {
echo '],
backgroundColor: \'rgba(37, 37, 235, 0.2)\',
borderColor: \'rgba(0, 0, 255, 1)\',
borderWidth: 1
borderWidth: 1,
}]
},
options: {
......@@ -1511,7 +1511,7 @@ if (isset($_GET['submit'])) {
</div>
<div id="BlocSubmit" class="form End">
<input id="Reset" type="button" value="<?= _('Reset') ?>" name="reset" />
<input id="donate" type="button" value="<?= _('Make a donation') ?>" onclick="location.href='https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=MBDD2TG6D4TPC&lc=FR&item_name=CalcPvAutonome&item_number=calcpvautonome&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted';" />
<input id="donate" type="button" value="<?= _('Support, contribute') ?>" />
<input id="Submit" type="submit" value="<?= _('Start the calculation') ?>" name="submit" />
</div>
<?php if (substr($locale, 0, 2) == 'fr') { ?>
......@@ -1519,7 +1519,71 @@ if (isset($_GET['submit'])) {
<?php } ?>
</form>
<!-- Donate campagne -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="closeDonate close">&times;</span>
<img id="DonateImg" src="./lib/reconnaissance.jpg" />
<h1><?= _('Support CaclPvAutonome') ?></h1>
<p style="font-size: 140%"><?= _('This software is <b>open</b>, <b>free</b>, collaborative and <b>independent</b> financially. <b>So that he can stay, we need your support</b>.') ?></p>
<p><?= _('To help us, you can also <a href="https://framagit.org/kepon/CalcPvAutonome" target="_blank">contribute to its improvement</a>, its <a href="https://crwd.in/calcpvautonome" target="_blank">translation</a>.') ?></p>
<p onclick="location.href='https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=MBDD2TG6D4TPC&lc=FR&item_name=CalcPvAutonome&item_number=calcpvautonome&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted';" class="DonateBouton" style="background-color: #4B82B8; color: #FFFFFF"><?= _('I want to make a secure one-time donation with Paypal') ?></p>
<p onclick="location.href='https://fr.liberapay.com/DavidMercereau/donate';" class="DonateBouton" style="background-color: #E6D815; color: #FFFFFF"><?= _('I want to make a recurring, free and secure donation with Liberapay') ?></p>
<p class="PasDonateButon closeDonate"><?= _('No thanks, I just want to <b>start the calculation</b>') ?></p>
<p class="PasDonateButon closeDonate" ><?= _('I already support CalcPvAutonomous') ?></p>
</div>
</div>
<script type="text/javascript">
/* Donate Campagne */
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
$( "#Submit" ).click(function( event ) {
if (getCookie("donate") == "") {
event.preventDefault();
donatePopupOn();
$(".PasDonateButon").show();
}
});
$( "#donate" ).click(function() {
$('.PasDonateButon').hide();
donatePopupOn();
});
$( ".closeDonate" ).click(function() {
donatePopupOff();
});
function donatePopupOn() {
$( "#myModal" ).show();
}
function donatePopupOff() {
$( "#myModal" ).hide();
setCookie('donate', 'off', 5)
}
/*window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}*/
</script>
<!-- Détection des changement dans le formulaire -->
<input type="hidden" value="0" id="ModificationDuFormulaire" />
......@@ -1763,7 +1827,7 @@ $(function() {
// Reset form
$( "#Reset" ).click(function() {
window.location = 'http://<?php echo $_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"] ?>';
window.location = '<?= $config_ini['formulaire']['UrlCalcPvAutonome'] ?>';
});
$(document).ready(function() {
......
......@@ -39,7 +39,7 @@ Pour les utilisateurs avancés :
#### Requis pour le fonctionnement / l'installation du
* PHP (5.6 minimum) + lib gd + GeoIP + CURL + Gettext
* Apache/Nginx (ou autre serveur web, service d'hébergement mutualisé...)
* Apache/Nginx (ou autre serveur web, service d'hébergement mutualisé...) avec URL Rewriting
#### Installation
......
......@@ -4,11 +4,11 @@
; Valeur par défaut du formulaire
[formulaire]
; Url CalcConsommation
UrlCalcConsommation='http://conso.calcpv.net/'
UrlCalcConsommation='https://conso.calcpv.net/'
; Url CalcPvAutonome
UrlCalcPvAutonome='http://calcpv.net/'
UrlCalcPvAutonome='https://calcpv.net/'
; Url Modèles
UrlModeles='http://calcpv.net/?p=Modeles'
UrlModeles='https://calcpv.net/?p=Modeles'
; Niveau par défaut (1=Débutant 2=Eclaire, 3=Expert)
Ni=2
; Panneaux personnalisé, tension
......
<?php
$CalcPvAutonomeVersion='4.0';
$CalcPvAutonomeVersion='4.0.1';
include_once('./lib/Fonction.php');
$config_ini = parse_ini_file('./config.ini', true);
// Modification / détection de la langue
if (isset($_POST['langue'])) {
setcookie("langue",$_POST['langue'],strtotime( '+1 year' ));
$locale = langue2locale($_POST['langue']);
// Langues disponibles :
$localeDispo=array('fr', 'en', 'nl', 'tr');
// Fonction de langue :
function langue2locale($langue) {
switch ($langue) {
case 'fr':
return 'fr_FR.utf8';
break;
case 'es':
return 'es_ES.utf8';
break;
case 'pt':
return 'pt_PT.utf8';
break;
case 'eo':
return 'eo.utf8';
break;
case 'nl':
return 'nl_NL.utf8';
break;
case 'tr':
return 'tr_TR.utf8';
break;
default:
return 'en_US.utf8';
}
}
// Détection et redirection (langue toujours)
if (isset($_GET['langue']) && in_array(substr($_GET['langue'], 0, 2), $localeDispo)) {
$locale = langue2locale($_GET['langue']);
if ($_COOKIE['langue'] != $_GET['langue']) {
setcookie("langue",$_GET['langue'],strtotime( '+1 year' ));
}
} elseif (isset($_GET['langue']) && !in_array(substr($_GET['langue'], 0, 2), $localeDispo)) {
$locale = langue2locale('en'); // Erreur ou hack :
header('Location: '.replaceLang2url($locale));
} elseif (isset($_COOKIE['langue'])) {
$locale = langue2locale($_COOKIE['langue']);
header('Location: '.addLang2url($locale));
} else {
$locale = langue2locale(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
header('Location: '.addLang2url($locale));
exit();
}
$localeshort=substr($locale, 0, 2);
// Définition de la langue :
putenv("LC_ALL=$locale");
putenv("LC_LANG=$locale");
putenv("LC_LANGUAGE=$locale");
setlocale(LC_ALL, $locale);
$results=putenv("LC_ALL=$locale");
if (!$results) {
exit ('putenv failed');
}
$results=putenv("LC_LANG=$locale");
if (!$results) {
exit ('putenv failed');
}
$results=putenv("LC_LANGUAGE=$locale");
if (!$results) {
exit ('putenv failed');
}
$results=setlocale(LC_ALL, $locale);
if (!$results) {
exit ('setlocale failed: locale function is not available on this platform, or the given local does not exist in this environment');
}
bindtextdomain("messages", "./lang");
textdomain("messages");
......@@ -50,12 +100,16 @@ $country = @geoip_country_code_by_name(get_ip());
<body>
<div id="page-wrap">
<div id="langues">
<form name="ChoixDeLangue" class="formChoixDeLangue" method="post" action="#">
<input type="hidden" name="langue" value="">
<a href="javascript:choixLangue('fr');"><img class="drapeau<?php langActive($locale, 'fr') ?>" src="./lib/fr.png" alt="FR" /></a>
<a href="javascript:choixLangue('en');"><img class="drapeau<?php langActive($locale, 'en') ?>" src="./lib/en.png" alt="EN" /></a>
<a href="https://crwd.in/calcpvautonome"><img class="drapeau" src="./lib/trad.png" alt="Help to translate" /></a>
</form>
<?php
foreach($localeDispo as $langPossible) {
$flag='';
if (substr($locale, 0, 2) == $langPossible) {
$flag=' drapeauActif';
}
echo '<a href="'.replaceLang2url($langPossible).'"><img class="drapeau'.$flag.'" src="./lib/'.$langPossible.'.png" alt="'.$langPossible.'" /></a>';
}
?>
<a href="https://crwd.in/calcpvautonome"><img class="drapeau" src="./lib/trad.png" alt="Help to translate" /></a>
</div>
<?php
$footer=true;
......@@ -66,30 +120,16 @@ $country = @geoip_country_code_by_name(get_ip());
|| $_SERVER['HTTP_HOST'] == 'calcconso.zici.fr') {
echo '<h1>'._('Caculate daily electric needs').'</h1>';
@include_once('./header.php');
echo _('<p>Go to the <a href="https://crwd.in/calcpvautonome" target="_blank">colaborative translation platform</a> to help us translate this free software.</p>');
include('./CalcConsommation.php');
@include_once('./bottom.php');
} elseif (isset($_GET['p']) && $_GET['p'] == 'Modeles') {
include('./Modeles.php');
$footer=false;
} else {
/*
if ($localeshort == 'en' && !preg_match('#StandAlone.php$#',$_SERVER['SCRIPT_URL'])) {
if (isset($_SERVER['QUERY_STRING'])) {
echo '<script type="text/javascript">document.location.href="./StandAlone.php?'.$_SERVER['QUERY_STRING'].'";</script>';
} else {
echo '<script type="text/javascript">document.location.href="./StandAlone.php";</script>';
}
}
if ($localeshort == 'fr' && !preg_match('#Autonome.php$#',$_SERVER['SCRIPT_URL'])) {
if (isset($_SERVER['QUERY_STRING'])) {
echo '<script type="text/javascript">document.location.href="./Autonome.php?'.$_SERVER['QUERY_STRING'].'";</script>';
} else {
echo '<script type="text/javascript">document.location.href="./Autonome.php";</script>';
}
}
*/
echo '<h1>'._('Caculate/size photovoltaic stand-alone (autonomous) set').'</h1>';
@include_once('./header.php');
echo _('<p>Go to the <a href="https://crwd.in/calcpvautonome" target="_blank">colaborative translation platform</a> to help us translate this free software.</p>');
include('./CalcPvAutonome.php');
@include_once('./bottom.php');
}
......@@ -102,9 +142,16 @@ $country = @geoip_country_code_by_name(get_ip());
if ($localeshort == 'en') {
echo 'nednet, coucou39, guillerette, mirrim, ppmt';
}
if ($localeshort == 'nl') {
echo 'StarlightF';
}
if ($localeshort == 'tr') {
echo 'Harun Demirel';
}
?>
<?= _('for this English <a target="_blank" href="https://crwd.in/calcpvautonome">translation</a>') ?></p>
<?= _('for this <a target="_blank" href="https://crwd.in/calcpvautonome">translation</a>') ?></p>
<?php } ?>
<?= _('<p>Go to the <a href="https://crwd.in/calcpvautonome" target="_blank">colaborative translation platform</a> to help us translate this free software.</p>'); ?>
<p class="footer_right"><?= _('By') ?> <a href="http://david.mercereau.info/">David Mercereau</a> (<a href="https://framagit.org/kepon/CalcPvAutonome"><?= _('Git repository') ?></a>)</p>
<p class="footer_left">CalcPvAutonome <?= _('version') ?> <?= $CalcPvAutonomeVersion ?> <?= _('is an open software licensed <a href="https://en.wikipedia.org/wiki/Beerware">Beerware</a>') ?></p>
</div>
......@@ -143,10 +190,6 @@ $(document).ready(function() {
$(this).children('div#tooltip').remove();
});
});
function choixLangue(value_langue) {
document.forms['ChoixDeLangue'].langue.value = value_langue;
document.forms['ChoixDeLangue'].submit();
}
</script>
</body>
</html>
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: calcpvautonome\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-02 22:19+0100\n"
"PO-Revision-Date: 2018-02-02 16:23-0500\n"
"POT-Creation-Date: 2018-02-16 03:03+0100\n"
"PO-Revision-Date: 2018-02-15 21:11-0500\n"
"Last-Translator: kepon85 <david@mercereau.info>\n"
"Language-Team: French\n"
"Language: fr_FR\n"
......@@ -14,7 +14,7 @@ msgstr ""
"X-Generator: crowdin.com\n"
"X-Crowdin-Project: calcpvautonome\n"
"X-Crowdin-Language: fr\n"
"X-Crowdin-File: /v4.0/v4.0 - en prod actuellement.pot\n"
"X-Crowdin-File: /v4.0/messages.pot\n"
#: CalcConsommation.php:2
msgid "In order to know the electric consumption (in Watts) of your devices you may"
......@@ -908,7 +908,7 @@ msgstr "Câblage"
msgid "Which brings to a total budget <b>between %s and %s&euro;</b>. Cost of panels support, wire, wire terminal and protection elements (fuse, battery cut-off, ...) is not included"
msgstr "Ce qui nous fait un budget total <b>entre %s et %s&euro;</b>. A ça, il faut ajouter le prix des supports de panneaux, du câblage, des cosses ainsi que celui des éléments de protections (fusibles, coupe batterie...)"
#: CalcPvAutonome.php:1023
#: CalcPvAutonome.php:1023 CalcPvAutonome.php:1514
#, php-format
msgid "Support, contribute"
msgstr "Soutenir, contribuer"
......@@ -948,9 +948,9 @@ msgstr "<a href=\"%s\">Cette simulation</a> estime, qu'avec votre consommation
msgid "~%dW panel (%d\"%dW for example)"
msgstr "~%dW de panneau solaire (%d\"%dW par exemple)"
#: CalcPvAutonome.php:1035
#: CalcPvAutonome.php:1035 CalcPvAutonome.php:1040
#, php-format
msgid "~%dAh battery in %dV (%d\"%dAh of %dV for example)"
msgid "~%dAh battery in %dV (%d\"%dAh in %dV for example)"
msgstr "~%dAh de batterie en %dV (%d\"%dAh en %dV par exemple)"
#: CalcPvAutonome.php:1037 CalcPvAutonome.php:1041
......@@ -963,11 +963,6 @@ msgstr "Le budget est estimé entre %s et %s&euro;"
msgid "[url=%s]This simulation[url] estimates that with your consumption of %dWh/d you would need:"
msgstr "[url=%s]Cette simulation[url] estime, qu'avec votre consommation électrique de %dWh/j, vous auriez besoins de :"
#: CalcPvAutonome.php:1040
#, php-format
msgid "~%dAh battery in %dV (%d\"%dAh in %dV for example)"
msgstr "~%dAh de batterie en %dV (%d\"%dAh en %dV par exemple)"
#: CalcPvAutonome.php:1123
msgid "Your degree of knowledge in photovoltaics"
msgstr "Votre degré de connaissance en photovoltaïque"
......@@ -1213,43 +1208,71 @@ msgstr "Ratio pour se prémunir de l'échauffement du câble"
msgid "Reset"
msgstr "Remise à 0"
#: CalcPvAutonome.php:1514
msgid "Make a donation"
msgstr "Faire un don"
#: CalcPvAutonome.php:1515
msgid "Start the calculation"
msgstr "Lancer le calcul"
#: index.php:32 index.php:73
#: CalcPvAutonome.php:1528
msgid "Support CaclPvAutonome"
msgstr "Soutenez CaclPvAutonome"
#: CalcPvAutonome.php:1529
msgid "This software is <b>open</b>, <b>free</b>, collaborative and <b>independent</b> financially. <b>So that he can stay, we need your support</b>."
msgstr "Ce logiciel est <b>gratuit</b>, <b>libre de droit</b>, collaboratif et <b>indépendant</b> financièrement. Afin qu'il puisse le rester, nous avons besoin de votre soutien."
#: CalcPvAutonome.php:1530
msgid "To help us, you can also <a href=\"https://framagit.org/kepon/CalcPvAutonome\" target=\"_blank\">contribute to its improvement</a>, its <a href=\"https://crwd.in/calcpvautonome\" target=\"_blank\">translation</a>."
msgstr "Pour nous aider, vous pouvez aussi <a href=\"https://framagit.org/kepon/CalcPvAutonome\" target=\"_blank\">contribuer à son amélioration</a>, sa <a href=\"https://crwd.in/calcpvautonome\" target=\"_blank\">traduction</a>."
#: CalcPvAutonome.php:1531
msgid "I want to make a secure one-time donation with Paypal"
msgstr "Je souhaite faire un don sécurisé ponctuel avec Paypal"
#: CalcPvAutonome.php:1532
msgid "I want to make a recurring, free and secure donation with Liberapay"
msgstr "Je souhaite faire un don récurent, libre et sécurisé avec liberapay"
#: CalcPvAutonome.php:1533
msgid "No thanks, I just want to <b>start the calculation</b>"
msgstr "Non merci, je souhaite seulement lancer le calcul"
#: CalcPvAutonome.php:1534
msgid "I already support CalcPvAutonomous"
msgstr "Je soutiens déjà CalcPvAutonome"
#: index.php:82 index.php:130
msgid "Caculate/size photovoltaic stand-alone (autonomous) set"
msgstr "Calculer/dimensionner son installation photovoltaïque isolée (autonome)"
#: index.php:65
#: index.php:121
msgid "Caculate daily electric needs"
msgstr "Calculer ces besoins électriques journaliers"
#: index.php:82
#: index.php:123 index.php:132 index.php:154
msgid "<p>Go to the <a href=\"https://crwd.in/calcpvautonome\" target=\"_blank\">colaborative translation platform</a> to help us translate this free software.</p>"
msgstr "<p>Rendez-vous sur la <a href=\"https://crwd.in/calcpvautonome\" target=\"_blank\">plateforme collaborative de traduction</a> pour nous aider à traduire ce logiciel.</p>"
#: index.php:140
msgid "Thanks to"
msgstr "Merci à"
#: index.php:88
msgid "for this English <a target=\"_blank\" href=\"https://crwd.in/calcpvautonome\">translation</a>"
msgstr "pour cette <a target=\"_blank\" href=\"https://crwd.in/calcpvautonome\">traduction française</a>"
#: index.php:152
msgid "for this <a target=\"_blank\" href=\"https://crwd.in/calcpvautonome\">translation</a>"
msgstr "pour cette <a target=\"_blank\" href=\"https://crwd.in/calcpvautonome\">translation</a>"
#: index.php:90
#: index.php:155
msgid "By"
msgstr "Par"
#: index.php:90
#: index.php:155
msgid "Git repository"
msgstr "Dépôt Git"
#: index.php:91
#: index.php:156
msgid "version"
msgstr "version"
#: index.php:91
#: index.php:156
msgid "is an open software licensed <a href=\"https://en.wikipedia.org/wiki/Beerware\">Beerware</a>"
msgstr "est un logiciel libre sous licence <a href=\"https://fr.wikipedia.org/wiki/Beerware\">Beerware</a>"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-02 22:19+0100\n"
"POT-Creation-Date: 2018-02-16 03:03+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -1054,7 +1054,7 @@ msgid ""
"cut-off, ...) is not included"
msgstr ""
#: CalcPvAutonome.php:1023
#: CalcPvAutonome.php:1023 CalcPvAutonome.php:1514
#, php-format
msgid "Support, contribute"
msgstr ""
......@@ -1098,9 +1098,9 @@ msgstr ""
msgid "~%dW panel (%d\"%dW for example)"
msgstr ""
#: CalcPvAutonome.php:1035
#: CalcPvAutonome.php:1035 CalcPvAutonome.php:1040
#, php-format
msgid "~%dAh battery in %dV (%d\"%dAh of %dV for example)"
msgid "~%dAh battery in %dV (%d\"%dAh in %dV for example)"
msgstr ""
#: CalcPvAutonome.php:1037 CalcPvAutonome.php:1041
......@@ -1115,11 +1115,6 @@ msgid ""
"you would need:"
msgstr ""
#: CalcPvAutonome.php:1040
#, php-format
msgid "~%dAh battery in %dV (%d\"%dAh in %dV for example)"
msgstr ""
#: CalcPvAutonome.php:1123
msgid "Your degree of knowledge in photovoltaics"
msgstr ""
......@@ -1373,45 +1368,81 @@ msgstr ""
msgid "Reset"
msgstr ""
#: CalcPvAutonome.php:1514
msgid "Make a donation"
msgstr ""
#: CalcPvAutonome.php:1515
msgid "Start the calculation"
msgstr ""
#: index.php:32 index.php:73
#: CalcPvAutonome.php:1528
msgid "Support CaclPvAutonome"
msgstr ""
#: CalcPvAutonome.php:1529
msgid ""
"This software is <b>open</b>, <b>free</b>, collaborative and <b>independent</"
"b> financially. <b>So that he can stay, we need your support</b>."
msgstr ""
#: CalcPvAutonome.php:1530
msgid ""
"To help us, you can also <a href=\"https://framagit.org/kepon/CalcPvAutonome"
"\" target=\"_blank\">contribute to its improvement</a>, its <a href="
"\"https://crwd.in/calcpvautonome\" target=\"_blank\">translation</a>."
msgstr ""
#: CalcPvAutonome.php:1531
msgid "I want to make a secure one-time donation with Paypal"
msgstr ""
#: CalcPvAutonome.php:1532
msgid "I want to make a recurring, free and secure donation with Liberapay"
msgstr ""
#: CalcPvAutonome.php:1533
msgid "No thanks, I just want to <b>start the calculation</b>"
msgstr ""
#: CalcPvAutonome.php:1534
msgid "I already support CalcPvAutonomous"
msgstr ""
#: index.php:82 index.php:130
msgid "Caculate/size photovoltaic stand-alone (autonomous) set"
msgstr ""
#: index.php:65
#: index.php:121
msgid "Caculate daily electric needs"
msgstr ""
#: index.php:82
#: index.php:123 index.php:132 index.php:154
msgid ""
"<p>Go to the <a href=\"https://crwd.in/calcpvautonome\" target=\"_blank"
"\">colaborative translation platform</a> to help us translate this free "
"software.</p>"
msgstr ""
#: index.php:140
msgid "Thanks to"
msgstr ""
#: index.php:88
#: index.php:152
msgid ""
"for this English <a target=\"_blank\" href=\"https://crwd.in/calcpvautonome"
"for this <a target=\"_blank\" href=\"https://crwd.in/calcpvautonome"
"\">translation</a>"
msgstr ""
#: index.php:90
#: index.php:155
msgid "By"
msgstr ""
#: index.php:90
#: index.php:155
msgid "Git repository"
msgstr ""
#: index.php:91
#: index.php:156
msgid "version"
msgstr ""
#: index.php:91
#: index.php:156
msgid ""
"is an open software licensed <a href=\"https://en.wikipedia.org/wiki/Beerware"
"\">Beerware</a>"
......
This diff is collapsed.
Modification source traduction
xgettext *.php -o lang/messages.pot --from-code="UTF-8"
msgmerge --no-wrap -N lang/fr/LC_MESSAGES/messages.po messages.pot > lang/fr/LC_MESSAGES/messages-new.po
vérifier la fin des fichiers mergé (le commenté), c'est ce qui n'est plus dans le .pot
https://maxime.sh/2012/06/utilisation-pratique-de-gettext-avec-php/
Mettre à jour les .mo à partir du .po
msgfmt lang/fr/LC_MESSAGES/messages.po -o lang/fr/LC_MESSAGES/messages.mo
Ajout d'une langue :
vérifier sa présence sur le système : locale -a
Si elle n'y est pas on l'installe
dpkg-reconfigure locales
Vérifier en haut du fichier index.php qu'elle est présente
// Langues disponibles :
$localeDispo=array('fr', 'en', 'nl');
// Fonction de langue :
function langue2locale($langue) {
switch ($langue) {
case 'fr':
return 'fr_FR.utf8';
break;
case 'es':
return 'es_ES.utf8';
...
Faire un drapeau dans lib (qui doit être en PNG
Déposer les fichier dans lang
Redémarrer apache ou php fpm après changement dans lang
This diff is collapsed.
......@@ -445,31 +445,25 @@ function pgvisParseData($FichierDataCsv) {
return $GlobalIradiation;
}
// Fonction de langue :
function langue2locale($langue) {
switch ($langue) {
case 'fr':
return 'fr_FR.utf8';
break;
/*
case 'es':
return 'es_ES.utf8';
break;
case 'pt':
return 'pt_PT.utf8';
break;
case 'eo':
return 'eo.utf8';
break;
*/
default:
return 'en_US.utf8';
// Ajoute la langue à une URL qui n'en a pas
function addLang2url($locale) {
global $_SERVER;
$URIexplode=explode('?', $_SERVER['REQUEST_URI']);
if ($URIexplode[1] != '') {
return $URIexplode[0].substr($locale, 0, 2).'?'.$URIexplode[1];
} else {
return $URIexplode[0].substr($locale, 0, 2);
}
}
// Juste pour afficher la langue active
function langActive($locale, $drapeau) {
if (substr($locale, 0, 2) == $drapeau) {
echo ' drapeauActif';
function replaceLang2url($locale) {
global $_SERVER;
$URIexplode=explode('?', $_SERVER['REQUEST_URI']);
$debutUrl=substr($URIexplode[0], 0, -2);
if ($URIexplode[1] != '') {
return $debutUrl.substr($locale, 0, 2).'?'.$URIexplode[1];
} else {
return $debutUrl.substr($locale, 0, 2);
}
}
?>
lib/en.png

1.12 KB | W: | H:

lib/en.png

1.05 KB | W: | H:

lib/en.png
lib/en.png
lib/en.png
lib/en.png
  • 2-up
  • Swipe
  • Onion skin
lib/fr.png

919 Bytes | W: | H:

lib/fr.png

914 Bytes | W: | H:

lib/fr.png
lib/fr.png
lib/fr.png
lib/fr.png
  • 2-up
  • Swipe
  • Onion skin
lib/nl.png

923 Bytes

......@@ -241,3 +241,53 @@ img.drapeauActif {
.pvgisSHScalc {
width: 70%;
}
/* Donate campagn
* https://www.w3schools.com/howto/howto_css_modals.asp */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 700px;
}
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
cursor:pointer;
}
#DonateImg {
float: right;
width: 150px;
padding-right: 40px;
}
.DonateBouton {
width: 96%;
text-align: center;
padding: 10px;
font-weight: bold;
cursor:pointer;
}
.PasDonateButon {
width: 96%;
text-align: center;
padding: 10px;
cursor:pointer;
border: 1px solid #C5C5C5;
}
/* Donate end */
lib/tr.png

993 Bytes