Blablatorium > Liens externes
Apprendre du vocabulaire Japonais
$p00ky:
Tweet
Il me semble qu'AkumA voulait un p'tit truc ressemblant à mon script pour apprendre les kana, mais pour apprendre du vocabulaire.
Étant donné que j'avais aussi du vocabulaire à apprendre, j'ai fait un p'tit truc assez basique pour apprendre du vocabulaire.
Démo
Bon c'est encore en test et ça vaut pas un clou, cependant comme je file aussi le code source, libre à vous de vous faire plaisir.
Si j'apporte de grosses modifs, je les ferais parvenir ici.
Code: [Sélectionner]>>>><html>
<head>
<title>P'tit prog pour apprendre son vocabulaire by $p00ky</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body OnLoad="document.repondre.reponse_francais.focus();">
<script language=javascript>document.getElementById('repondre').focus();</script>
<p align=center><b>Apprendre son vocabulaire</b><br><br>
<?php
// Génération du vecteur hiraganas <> katakanas <> romaji
// ----------------------------------------------------------------------
// Le vocabulaire
$tableau[1] = Array(
'romaji' => 'kamikaze',
'hiragana' => 'かみかぜ',
'kanji' => '神風',
'francais' => 'typhon'
);
$tableau[2] = Array(
'romaji' => 'shiitake',
'hiragana' => 'しいたけ',
'kanji' => '',
'francais' => 'champignon'
);
$tableau[3] = Array(
'romaji' => 'tomodachi',
'hiragana' => 'ともだち',
'kanji' => '',
'francais' => 'ami'
);
$tableau[4] = Array(
'romaji' => 'hebi',
'hiragana' => 'へび',
'kanji' => '',
'francais' => 'serpent'
);
$tableau[5] = Array(
'romaji' => 'ebi',
'hiragana' => 'えび',
'kanji' => '',
'francais' => 'crevette'
);
$tableau[6] = Array(
'romaji' => 'aibo',
'hiragana' => 'あいぼ',
'kanji' => '',
'francais' => 'chien'
);
$tableau[7] = Array(
'romaji' => 'nihon',
'hiragana' => 'にほん',
'kanji' => '日本',
'francais' => 'Japon'
);
$tableau[8] = Array(
'romaji' => 'nin',
'hiragana' => 'にん',
'kanji' => '人',
'francais' => 'personne'
);
function kanji_existe($input) {
global $tableau;
return (!($tableau[$input]['kanji']==""));
}
function kanji($input) {
global $tableau;
if ($tableau[$input]['kanji']=="") {
$output = $tableau[$input]['hiragana'];
} else {
$output = $tableau[$input]['kanji'];
}
return $output;
}
function romaji($input) {
global $tableau;
return $tableau[$input]['romaji'];
}
function francais($input) {
global $tableau;
return $tableau[$input]['francais'];
}
function kana($input) {
global $tableau;
return $tableau[$input]['hiragana'];
}
function japonais($input) {
global $tableau;
(kanji_existe($input)) ?
$output = kanji($input)." [".$tableau[$input]['hiragana']."]":
$output = $tableau[$input]['hiragana'];
return $output;
}
$min = 1;
$max = count($tableau);
// Si on est en mode affichage du vocabulaire
if (isset($_GET['afficher'])) {
echo "<br><br><table align=center width=500 cellpadding=2px cellspacing=0><tr><td colspan=4 style=\"background-color:black;\" align=center><b><font color=white>Liste de vocabulaire</font></b></td></tr>";
echo "<tr><td style=\"background-color:#cccccc;\" align=center><b><font color=white>Romaji</font></b></td>";
echo "<td style=\"background-color:#cccccc;\" align=center><b><font color=white>Kana</font></b></td>";
echo "<td style=\"background-color:#cccccc;\" align=center><b><font color=white>Français</font></b></td>";
echo "<td style=\"background-color:#cccccc;\" align=center><b><font color=white>Kanji</font></b></td></tr>";
for ($c=$min;$c<=$max;$c++) {
echo "<tr>";
echo "<td>".romaji($c)."</td>";
echo "<td>".kana($c)."</td>";
echo "<td>".francais($c)."</td>";
echo "<td>";
if (kanji_existe($c)) { echo kanji($c); }
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br><br><a href=?>Retour</a></center>";
exit(1);
}
// Génération des options
//-----------------------------------------
if (isset($_POST['taille'])) {
$taille = $_POST['taille'];
} else {
$taille = "70pt";
}
if (isset($_POST['mode'])) {
$mode = $_POST['mode'];
} else {
$mode = "jp-fr";
}
?>
</p>
<form method=post name=options>
<table align=center width=500 cellpadding=2px cellspacing=0><tr><td colspan=2 style="background-color:black;" align=center><b><font color=white>Changer les options</font></b></td></tr>
<tr>
<td align=center colspan=2 valign=center>
Mode : <select name=mode>
<option value="jp-fr">Japonais -> Français</option>
<option value="fr-jp">Français -> Japonais</option>
</select>
Taille : <select name=taille>
<option value="70pt">Gros</option>
<option value="50pt">Moyen</option>
<option value="30pt">Petit</option>
</select>
</td>
</tr>
<tr>
<td colspan=2 style="background-color:black;" align=center>
<input type=submit value="Changer de mode">
</td>
</table>
<br><br><br>
</form>
<?php
$reponse_romaji = "";
$reponse_francais = "";
// MODE JAPONAIS --> FRANÇAIS
if ($mode=="jp-fr")
{
if (!isset($_POST['actuel']))
{
$nb = mt_rand($min, $max);
}
else
{
$nb = $_POST['actuel'];
$question = japonais($nb);
if (isset($_POST['reponse_romaji'])) { $reponse_romaji = $_POST['reponse_romaji']; }
$reponse_francais = $_POST['reponse_francais'];
// S'il ne connaît pas la réponse
if ($reponse_romaji=="?"||$reponse_francais=="?")
{
echo "<center>Muhaha ! Alors comme ça on sait pas ? Bouh ! <font color=red size=$taille>$question</font> voulait dire <font color=red size=$taille>".$tableau[$nb]['francais'];
echo "</font><br>Aller, faut bosser ça ^^<br><br><br></center>";
$nb = mt_rand($min, $max);
$reponse_romaji = "";
$reponse_francais == "";
}
else
{
// Si c'était un kanji, on teste son écriture en romaji
if (kanji_existe($nb))
{
if ($reponse_romaji == romaji($nb))
{
echo "<center>Oui, <font size=$taille>".kanji($nb)."</font> est bien <font size=$taille>$reponse_romaji</font></center><br>";
}
else
{
echo "<center>Ah non, ".kanji($nb)." n'est pas $reponse_romaji</center><br>";
}
}
// On teste sa traduction
if ($reponse_francais == francais($nb))
{
echo "<center>Oui, <font size=$taille>".kanji($nb)."</font> est bien <font size=$taille>$reponse_francais</font></center><br>";
}
else
{
echo "<center>Ah non, ".kanji($nb)." ne signifie pas $reponse_francais</center><br>";
}
// A-t-on eu les deux justes ?
if (($reponse_francais == francais($nb))&&(!kanji_existe($nb)||(kanji_existe($nb)&&($reponse_romaji == romaji($nb)))))
{
$nb = mt_rand($min, $max);
$reponse_romaji = "";
$reponse_francais = "";
}
}
}
$actuel = kanji($nb);
echo "<br><br><br><center><font size=$taille>$actuel</font><br><br><br></center><form method=post name=repondre>";
echo "<input type=hidden value=$nb name=actuel><input type=hidden name=mode value=$mode>";
echo "<input type=hidden value=$taille name=taille>";
echo "<center>Signifie en français : <input type=text name=reponse_francais value=$reponse_francais></center><br>";
if (kanji_existe($nb))
{
echo "<center>S'écrit en romaji : <input type=text name=reponse_romaji value=$reponse_romaji></center><br>";
}
echo"<br><center><input type=submit value=\"Répondre\"></center></form>";
}
// MODE FRANÇAIS --> JAPONAIS
else
{
if (!isset($_POST['actuel']))
{
$nb = mt_rand($min, $max);
}
else
{
$nb = $_POST['actuel'];
$question = francais($nb);
$reponse = $_POST['reponse_francais'];
// S'il ne connaît pas la réponse
if ($reponse=="?")
{
echo "<center>Muhaha ! Alors comme ça on sait pas ? Bouh ! <font color=red size=$taille>$question</font> se disait <font color=red size=$taille>".japonais($nb)." : ".$tableau[$nb]['romaji'];
echo "</font><br>Aller, faut bosser ça ^^<br><br><br></center>";
$nb = mt_rand($min, $max);
$reponse_francais == "";
}
else
{
// On teste sa traduction
if ($reponse == romaji($nb))
{
echo "<center>Oui, <font size=$taille>".francais($nb)."</font> se dit bien <font size=$taille>$reponse</font> ".japonais($nb)."en japonais</center><br>";
$nb = mt_rand($min, $max);
$reponse = "";
}
else
{
echo "<center>Ah non, ".francais($nb)." ne se dit pas $reponse en japonais</center><br>";
}
}
}
$actuel = kanji($nb);
echo "<br><br><br><p align=center><font size=$taille>$actuel</font><br><br></p><form method=post name=repondre>";
echo "<input type=hidden value=$nb name=actuel><input type=hidden name=mode value=$mode>";
echo "<input type=hidden value=$taille name=taille>";
echo "<center>Se dit en japonais : <input type=text name=reponse_francais value=$reponse></center><br>";
echo"<br><center><input type=submit value=\"Répondre\"></center></form>";
}
?>
<br><br>
<center><a href="?afficher=1">Afficher le vocabulaire</a></center>
</center>
</body>
</html>
<<<<
GGF:
ca peut etre utile ceci ^^
Fye-Tofe59:
petit up
http://www.crapulescorp.net/japonais/index.php5
site bien fait avec des histoire en hiragana pour s'entrainer a la lecture
raigomaru:
dis voir spooky tu crois qu'il y a moyen de le compiler en .nds?
$p00ky:
Pour Nintendo DS ?
J'ai aucune idée de comment ça fonctionne la DS...
Mais vu que dans cette version, je n'utilise pas de base de données, ça doit être faisable.
Par contre faudrait plutôt utiliser un fichier .xml séparé pour gérer le voca je pense.
Navigation
[#] Page suivante