示例#1
0
 /**
  * nombre_dia_semana
  * @return el nombre del dia a partir de una fecha dada
  */
 protected function nombre_dia_semana($fecha)
 {
     //var_dump($fecha);
     if (strpos($fecha, '/') !== FALSE) {
         $fecha = tr_replace('/', '-', $fecha);
     }
     $dias = array('Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo');
     $aindex = (int) date(W, strtotime($fecha));
     $aindex--;
     return $dias[$aindex];
 }
示例#2
0
文件: tra.php 项目: rjsmelo/tiki
/**
 * needs description
 * @param        $content
 * @param string $lg
 * @param array  $args
 *
 * @return mixed|string
 */
function tra_impl($content, $lg = '', $args = array())
{
    global $prefs, $tikilib;
    if (empty($content) && $content !== '0') {
        return '';
    }
    global ${"lang_{$lg}"};
    if ($lg and isset(${"lang_{$lg}"}[$content])) {
        return tr_replace(${"lang_{$lg}"}[$content], $args);
    } else {
        // If no translation has been found and if the string ends with a punctuation,
        //   try to translate punctuation separately (e.g. if the content is 'Login:'******'Login :'******'Log In' and ':' separately).
        // This should avoid duplicated strings like 'Log In' and 'Log In:' that were needed before
        //   (because there is no space before ':' in english, but there is one in others like french)
        $lastCharacter = $content[strlen($content) - 1];
        if (in_array($lastCharacter, array(':', '!', ';', '.', ',', '?'))) {
            // Modify get_strings.php accordingly
            $new_content = substr($content, 0, -1);
            if (isset(${"lang_{$lg}"}[$new_content])) {
                return tr_replace(${"lang_{$lg}"}[$new_content] . (isset(${"lang_{$lg}"}[$lastCharacter]) ? ${"lang_{$lg}"}[$lastCharacter] : $lastCharacter), $args);
            }
        }
    }
    // ### Trebly:B00624-01:added test on tikilib existence : on the first launch of tra tikilib is not yet set
    if (isset($prefs['record_untranslated']) && $prefs['record_untranslated'] == 'y' && $lg != 'en' && isset($tikilib)) {
        $query = 'select `id` from `tiki_untranslated` where `source`=? and `lang`=?';
        if (!$tikilib->getOne($query, array($content, $lg))) {
            $query = "insert into `tiki_untranslated` (`source`,`lang`) values (?,?)";
            $tikilib->query($query, array($content, $lg), -1, -1, false);
        }
    }
    return tr_replace($content, $args);
}