if n < 0, use n chars from the end of the string, eg. for zh-tw

This commit is contained in:
Ralf Becker 2006-03-08 11:36:58 +00:00
parent ed6acc5e84
commit 23c4f7976f

View File

@ -251,9 +251,11 @@ foreach($day2int as $name => $n)
Calendar._SDN = new Array
(<?php // short day names
$chars_shortcut = (int) lang('3 number of chars for day-shortcut'); // < 0 to take the chars from the end
foreach($day2int as $name => $n)
{
echo "\n \"".substr(lang($name),0,(int)lang('3 number of chars for day-shortcut')).'"'.($n < 6 ? ',' : '');
echo "\n \"".($chars_shortcut > 0 ? substr(lang($name),0,$chars_shortcut) :
substr(lang($name),$chars_shortcut)).'"'.($n < 6 ? ',' : '');
}
?>);
Calendar._SDN_len = <?php echo (int) lang('3 number of chars for day-shortcut'); ?>;
@ -275,7 +277,8 @@ foreach($monthnames as $n => $name)
$short = lang(substr($name,0,3)); // test if our lang-file have a translation for the english short with 3 chars
if (substr($short,-1) == '*') // else create one by truncating the full translation to x chars
{
$short = substr(lang($name),0,(int)lang('3 number of chars for month-shortcut'));
$chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end
$short = $chars_shortcut > 0 ? substr(lang($name),0,$chars_shortcut) : substr(lang($name),$chars_shortcut);
}
echo "\n \"".$short.'"'.($n < 11 ? ',' : '');
}