Browse Source

Adaptações para português

MOODLE_34_STABLE
Matheus Garcia 7 years ago
parent
commit
46a20bc412
  1. 12
      check.php
  2. 22
      hangman/play.php
  3. 1
      locallib.php

12
check.php

@ -280,12 +280,20 @@ function game_check_common_problems_shortanswer_hangman( $game, &$warnings, $a)
foreach ($a as $word) {
$word = game_upper( str_replace( ' ', '', $word), $game->language);
$word = str_replace('Ó', 'O', $word);
$word = str_replace('Ê', 'E', $word);
$word = str_replace('Ç', 'C', $word);
$word = str_replace('Ã', 'A', $word);
$word = str_replace('Á', 'A', $word);
$word = str_replace('Ó', 'O', $word);
$word = str_replace('Â', 'A', $word);
$word = str_replace('Í', 'I', $word);
if ($game->language == '') {
$game->language = game_detectlanguage( $word);
$word = game_upper( $word, $game->language);
}
$allletters = game_getallletters( $word, $game->language, $game->userlanguage);
if ($allletters != '') {
continue;
}
@ -295,6 +303,7 @@ function game_check_common_problems_shortanswer_hangman( $game, &$warnings, $a)
if (count( $ret) != 0) {
$warnings[] = get_string( 'common_problems_shortanswer_hangman', 'game').': '.count($ret).' ('.implode( ', ', $ret).')';
}
}
@ -312,4 +321,3 @@ function game_check_common_problems_crossword_cryptex($game, &$warnings) {
$warnings[] = get_string( 'common_problems_crossword_param1', 'game').' (='.$game->param1.')';
}
}

22
hangman/play.php

@ -65,6 +65,16 @@ function game_hangman_continue( $id, $game, $attempt, $hangman, $newletter, $act
}
$answer = game_upper( $rec->answertext, $game->language);
$answer = str_replace('Ó', 'O', $answer);
$answer = str_replace('Ê', 'E', $answer);
$answer = str_replace('Ç', 'C', $answer);
$answer = str_replace('Ã', 'A', $answer);
$answer = str_replace('Á', 'A', $answer);
$answer = str_replace('Ó', 'O', $answer);
$answer = str_replace('Â', 'A', $answer);
$answer = str_replace('Í', 'I', $answer);
echo("<script>console.log('PHPX: ".$answer."');</script>");
if ($game->language == '') {
$game->language = game_detectlanguage( $answer);
$answer = game_upper( $rec->answertext, $game->language);
@ -350,6 +360,8 @@ function hangman_showpage(&$done, &$correct, &$wrong, $max, &$wordline, &$wordli
$word = $query->answertext;
echo("<script>console.log('PHP: ".$word."');</script>");
$newletter = optional_param('newletter', "", PARAM_TEXT);
if ( $newletter == '_') {
$newletter = ' ';
@ -443,6 +455,7 @@ function hangman_showpage(&$done, &$correct, &$wrong, $max, &$wordline, &$wordli
$finishedword = ($done or $wrong >= $max);
$finished = false;
$updrec = new stdClass();
$updrec->id = $hangman->id;
$updrec->letters = $letters;
@ -569,7 +582,6 @@ function game_hangman_show_nextword( $id, $game, $attempt, $hangman) {
echo "<a href=\"{$CFG->wwwroot}/mod/game/attempt.php?$params";
} else {
game_hangman_onfinishgame( $game, $attempt, $hangman);
if (game_can_start_new_attempt( $game)) {
echo "<a href=\"{$CFG->wwwroot}/mod/game/attempt.php?id=$id\">".
get_string( 'nextgame', 'game').'</a> &nbsp; &nbsp; &nbsp; &nbsp; ';
@ -582,3 +594,11 @@ function game_hangman_show_nextword( $id, $game, $attempt, $hangman) {
echo "<a href=\"{$CFG->wwwroot}/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').'</a> ';
}
function debug_to_console( $data ) {
$output = $data;
if ( is_array( $output ) )
$output = implode( ',', $output);
echo "<script>console.log( 'Debug Objects: " . $output . "' );</script>";
}

1
locallib.php

@ -208,7 +208,6 @@ function game_question_shortanswer_glossary( $game, $allowspaces, $userepetition
if ( $rec->attachment != '') {
$rec->attachment = "glossary/{$game->glossaryid}/$rec->id/$rec->attachment";
}
return $rec;
}

Loading…
Cancel
Save