mirror of
https://github.com/soulaklabs/bitoduc.fr.git
synced 2025-12-09 01:23:24 +00:00
Merge pull request #64 from soulaklabs/code-en-francais
Traduction des noms de fonction en français.
This commit is contained in:
45
creuille.js
45
creuille.js
@@ -27,26 +27,26 @@ function sansAccents(mot) {
|
|||||||
// accentuées du français.
|
// accentuées du français.
|
||||||
// https://fr.wikipedia.org/wiki/Diacritiques_utilisés_en_français
|
// https://fr.wikipedia.org/wiki/Diacritiques_utilisés_en_français
|
||||||
return mot
|
return mot
|
||||||
.toLowerCase()
|
.enMinuscules()
|
||||||
.replace("à", "a")
|
.remplacer("à", "a")
|
||||||
.replace("â", "a")
|
.remplacer("â", "a")
|
||||||
.replace("ç", "c")
|
.remplacer("ç", "c")
|
||||||
.replace("é", "e")
|
.remplacer("é", "e")
|
||||||
.replace("è", "e")
|
.remplacer("è", "e")
|
||||||
.replace("ê", "e")
|
.remplacer("ê", "e")
|
||||||
.replace("ë", "e")
|
.remplacer("ë", "e")
|
||||||
.replace("î", "i")
|
.remplacer("î", "i")
|
||||||
.replace("ï", "i")
|
.remplacer("ï", "i")
|
||||||
.replace("ô", "o")
|
.remplacer("ô", "o")
|
||||||
.replace("ù", "u")
|
.remplacer("ù", "u")
|
||||||
.replace("ü", "u");
|
.remplacer("ü", "u");
|
||||||
}
|
}
|
||||||
|
|
||||||
function htmlifier(mot, langue){
|
function htmlifier(mot, langue){
|
||||||
var res = '<span class="mot-' + langue + '">' + mot[langue] + '</span>';
|
var res = '<span class="mot-' + langue + '">' + mot[langue] + '</span>';
|
||||||
if (langue == "francais") {
|
if (langue == "francais") {
|
||||||
if ("genre" in mot){
|
if ("genre" in mot){
|
||||||
var genre = 'N' + mot["genre"].toUpperCase();
|
var genre = 'N' + mot["genre"].enMajuscules();
|
||||||
res += ' <span class="genre">' + genre + '</span>';
|
res += ' <span class="genre">' + genre + '</span>';
|
||||||
}
|
}
|
||||||
if ("classe" in mot){
|
if ("classe" in mot){
|
||||||
@@ -72,7 +72,7 @@ function construitListe(traductions) {
|
|||||||
|
|
||||||
traductions = traductions["vrais mots"].concat(traductions["faux mots"]);
|
traductions = traductions["vrais mots"].concat(traductions["faux mots"]);
|
||||||
// tri par ordre alphabétique de la langue de départ
|
// tri par ordre alphabétique de la langue de départ
|
||||||
traductions.sort(function(traduction1, traduction2){
|
traductions.tri(function(traduction1, traduction2){
|
||||||
var s1 = sansAccents(traduction1[langue]);
|
var s1 = sansAccents(traduction1[langue]);
|
||||||
var s2 = sansAccents(traduction2[langue]);
|
var s2 = sansAccents(traduction2[langue]);
|
||||||
if (s1 > s2) {
|
if (s1 > s2) {
|
||||||
@@ -88,18 +88,19 @@ function construitListe(traductions) {
|
|||||||
$( "#index" ).html("");
|
$( "#index" ).html("");
|
||||||
|
|
||||||
var l = '';
|
var l = '';
|
||||||
for (var i=0; i < traductions.length; i++) {
|
for (var i=0; i < traductions.longueur(); i++) {
|
||||||
var mot = traductions[i];
|
var mot = traductions[i];
|
||||||
var c = sansAccents(mot[langue]).charAt(0).toUpperCase();
|
var c = sansAccents(mot[langue]).caractereA(0).enMajuscules();
|
||||||
|
|
||||||
|
|
||||||
if (c != l) {
|
if (c != l) {
|
||||||
l = c;
|
l = c;
|
||||||
$( "#index" ).append(
|
$( "#index" ).ajouter(
|
||||||
$("<a></a>")
|
$("<a></a>")
|
||||||
.attr("href", "#" + l)
|
.attr("href", "#" + l)
|
||||||
.html(l)
|
.html(l)
|
||||||
);
|
);
|
||||||
$( "#mots" ).append(
|
$( "#mots" ).ajouter(
|
||||||
$("<div></div>")
|
$("<div></div>")
|
||||||
.attr("class", "groupe-lettre")
|
.attr("class", "groupe-lettre")
|
||||||
.append($("<a></a>").attr("name", l))
|
.append($("<a></a>").attr("name", l))
|
||||||
@@ -108,9 +109,9 @@ function construitListe(traductions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$( "#mots" )
|
$( "#mots" )
|
||||||
.children()
|
.enfants()
|
||||||
.last()
|
.dernier()
|
||||||
.append(
|
.ajouter(
|
||||||
$("<div></div>")
|
$("<div></div>")
|
||||||
.attr("class", "definition")
|
.attr("class", "definition")
|
||||||
.html(
|
.html(
|
||||||
|
|||||||
26
fr.js
Normal file
26
fr.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
Objet = Object
|
||||||
|
Objet.creer = Objet.create
|
||||||
|
|
||||||
|
Chaine = String
|
||||||
|
Chaine.prototype.enMinuscules = Chaine.prototype.toLowerCase
|
||||||
|
Chaine.prototype.enMajuscules = Chaine.prototype.toUpperCase
|
||||||
|
Chaine.prototype.remplacer = Chaine.prototype.replace
|
||||||
|
Chaine.prototype.caractereA = Chaine.prototype.charAt
|
||||||
|
|
||||||
|
Tableau = Array
|
||||||
|
Tableau.prototype.tri = Tableau.prototype.sort
|
||||||
|
Tableau.prototype.longueur = function () { return this.length; }
|
||||||
|
Tableau.prototype.pousser = Tableau.prototype.push
|
||||||
|
|
||||||
|
document.creerElement = document.createElement
|
||||||
|
document.recupererElementParNomDEtiquette = document.getElementsByTagName;
|
||||||
|
document.localisation = document.location;
|
||||||
|
document.localisation.protocole = document.localisation.protocole;
|
||||||
|
|
||||||
|
jQuery.fn.extend({
|
||||||
|
clic: function (x) { return this.click(x); },
|
||||||
|
enfants: function () { return this.children(); },
|
||||||
|
dernier: function () { return this.last(); },
|
||||||
|
ajouter: function (x) { return this.append(x); }
|
||||||
|
});
|
||||||
|
$.recupererJSON = $.getJSON
|
||||||
17
index.html
17
index.html
@@ -7,12 +7,13 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="feuille_de_style.css" />
|
<link rel="stylesheet" type="text/css" href="feuille_de_style.css" />
|
||||||
|
|
||||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
|
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||||
<script type="text/javascript" src="creuille.js"></script>
|
<script type="text/javascript" src="fr.js" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" src="creuille.js" charset="utf-8"></script>
|
||||||
<script>
|
<script>
|
||||||
$( function() {
|
$( function() {
|
||||||
$.getJSON( "traductions.json", function( traductions ) {
|
$.recupererJSON( "traductions.json", function( traductions ) {
|
||||||
construitListe(traductions);
|
construitListe(traductions);
|
||||||
$( "#lienChange" ).click( function() {changeDeSens(traductions);} );
|
$( "#lienChange" ).clic( function() {changeDeSens(traductions);} );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -21,13 +22,13 @@
|
|||||||
<body>
|
<body>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var _gaq = _gaq || [];
|
var _gaq = _gaq || [];
|
||||||
_gaq.push(['_setAccount', 'UA-42609030-1']);
|
_gaq.pousser(['_setAccount', 'UA-42609030-1']);
|
||||||
_gaq.push(['_trackPageview']);
|
_gaq.pousser(['_trackPageview']);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
var ga = document.creerElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
ga.src = ('https:' == document.localisation.protocole ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
var s = document.recupererElementParNomDEtiquette('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<div id="tout">
|
<div id="tout">
|
||||||
|
|||||||
Reference in New Issue
Block a user