Witam.
1. 2.5.3
2. nie mogę znaleźć block.l.php... Przeszukałem pliki i w jednym znalazłem 2 funkcje, które póki co niewiele mi rozjaśniły sprawę, ale coś sprawdziłem dzięki temu. Wiem, że string jest hasowany na md5 i porównywany z kluczem w tablicy z tłumaczeniem. MD5 dla "Moje konto" to b22652b0e4a3d18fcff0e53f0fc14564 i taki klucz jest w pliku z tłumaczeniem (jak wspomniałem wyżej, {l}Moje konto{/l} zostanie prawidłowo przetłumaczone na 'Mein konto'). Sprawdziłem tak:
{php
}echo md5('{$aBreadcrumbs[br].title}') {/php
} // wygenerowałem hash dla '{$aBreadcrumbs[br].title}' - 8bacd0dd34989a96c6640709988dc0c4 i dodałem go do słownika
{l}{literal}{$aBreadcrumbs[br].title}{/literal}{/l} // nie działa, mimo że hash jest w słowniku :(
Wstawiam kod obu funkcji poniżej (
Int.Smarty.class.php):
/**
* Provides a PHP-side facility to translate strings through the IntSmarty system.
* Identical to the block IntSmarty tag {l}{/l}, it takes the provided string
* and attempts to find a suitable translation for the current language.
*
* @param string $value The string to translate
* @return string The translated version of the string for the current language,
* or the same string passed to the method if no translation was
* found.
*/
function translate($value)
{
{
return $this->translation[$hash];
else
{
$this->transtable_updated = true;
$this->translation[$hash] = $value;
return $value;
}
}
}
/**
* This function contains the functionality for the block-level {l}{/l} tags used in IntSmarty templates
* to provide the localization functionality. It is registered during the construction of an IntSmarty
* object.
*
* @param string $content The content of the template before it is compiled
* @param object $smarty A reference to the active Smarty class
* @return string The original template with all of the translations in place
*/
function smarty_lang_prefilter($content, &$smarty)
{
$inst = &$smarty->parent_inst;
/* Grab all of the tagged strings */
preg_match_all("!{$ldq}l{$rdq}(.*?){$ldq}/l{$rdq}!s", $content, $match);
foreach($match[1] as $str)
{
/* Do we have a translation for this string? */
{
/* Replace all occurances of this string with its translation */
$content = preg_replace("!{$ldq}l{$rdq}$q_str{$ldq}/l{$rdq}!s", $inst->translation[$hash], $content); }
else
{
$inst->transtable_updated = true;
$inst->translation[$hash] = $str;
}
}
/* Strip off the tags now that the strings have been replaced */
$content = preg_replace("!{$ldq}l{$rdq}(.*?){$ldq}/l{$rdq}!s", "\${1}", $content);
return $content;
}