mirror of
https://github.com/soulaklabs/bitoduc.fr.git
synced 2025-12-08 17:13:23 +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.
|
||||
// https://fr.wikipedia.org/wiki/Diacritiques_utilisés_en_français
|
||||
return mot
|
||||
.toLowerCase()
|
||||
.replace("à", "a")
|
||||
.replace("â", "a")
|
||||
.replace("ç", "c")
|
||||
.replace("é", "e")
|
||||
.replace("è", "e")
|
||||
.replace("ê", "e")
|
||||
.replace("ë", "e")
|
||||
.replace("î", "i")
|
||||
.replace("ï", "i")
|
||||
.replace("ô", "o")
|
||||
.replace("ù", "u")
|
||||
.replace("ü", "u");
|
||||
.enMinuscules()
|
||||
.remplacer("à", "a")
|
||||
.remplacer("â", "a")
|
||||
.remplacer("ç", "c")
|
||||
.remplacer("é", "e")
|
||||
.remplacer("è", "e")
|
||||
.remplacer("ê", "e")
|
||||
.remplacer("ë", "e")
|
||||
.remplacer("î", "i")
|
||||
.remplacer("ï", "i")
|
||||
.remplacer("ô", "o")
|
||||
.remplacer("ù", "u")
|
||||
.remplacer("ü", "u");
|
||||
}
|
||||
|
||||
function htmlifier(mot, langue){
|
||||
var res = '<span class="mot-' + langue + '">' + mot[langue] + '</span>';
|
||||
if (langue == "francais") {
|
||||
if ("genre" in mot){
|
||||
var genre = 'N' + mot["genre"].toUpperCase();
|
||||
var genre = 'N' + mot["genre"].enMajuscules();
|
||||
res += ' <span class="genre">' + genre + '</span>';
|
||||
}
|
||||
if ("classe" in mot){
|
||||
@@ -72,7 +72,7 @@ function construitListe(traductions) {
|
||||
|
||||
traductions = traductions["vrais mots"].concat(traductions["faux mots"]);
|
||||
// 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 s2 = sansAccents(traduction2[langue]);
|
||||
if (s1 > s2) {
|
||||
@@ -88,18 +88,19 @@ function construitListe(traductions) {
|
||||
$( "#index" ).html("");
|
||||
|
||||
var l = '';
|
||||
for (var i=0; i < traductions.length; i++) {
|
||||
for (var i=0; i < traductions.longueur(); i++) {
|
||||
var mot = traductions[i];
|
||||
var c = sansAccents(mot[langue]).charAt(0).toUpperCase();
|
||||
var c = sansAccents(mot[langue]).caractereA(0).enMajuscules();
|
||||
|
||||
|
||||
if (c != l) {
|
||||
l = c;
|
||||
$( "#index" ).append(
|
||||
$( "#index" ).ajouter(
|
||||
$("<a></a>")
|
||||
.attr("href", "#" + l)
|
||||
.html(l)
|
||||
);
|
||||
$( "#mots" ).append(
|
||||
$( "#mots" ).ajouter(
|
||||
$("<div></div>")
|
||||
.attr("class", "groupe-lettre")
|
||||
.append($("<a></a>").attr("name", l))
|
||||
@@ -108,9 +109,9 @@ function construitListe(traductions) {
|
||||
}
|
||||
|
||||
$( "#mots" )
|
||||
.children()
|
||||
.last()
|
||||
.append(
|
||||
.enfants()
|
||||
.dernier()
|
||||
.ajouter(
|
||||
$("<div></div>")
|
||||
.attr("class", "definition")
|
||||
.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" />
|
||||
|
||||
<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>
|
||||
$( function() {
|
||||
$.getJSON( "traductions.json", function( traductions ) {
|
||||
$.recupererJSON( "traductions.json", function( traductions ) {
|
||||
construitListe(traductions);
|
||||
$( "#lienChange" ).click( function() {changeDeSens(traductions);} );
|
||||
$( "#lienChange" ).clic( function() {changeDeSens(traductions);} );
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -21,13 +22,13 @@
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-42609030-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
_gaq.pousser(['_setAccount', 'UA-42609030-1']);
|
||||
_gaq.pousser(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
var ga = document.creerElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.localisation.protocole ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.recupererElementParNomDEtiquette('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<div id="tout">
|
||||
|
||||
Reference in New Issue
Block a user