"changes requested by Vietnamese translator nhatnamnv(at)gmail.com: short day-names can now be constructed (additionally) by separate translation of the 3-char english shortcut. You can still use the translation of the long name with the number of chars to use for your language."

This commit is contained in:
Ralf Becker 2008-08-12 05:15:59 +00:00
parent eae198cf6c
commit 48060983f2

View File

@ -1,18 +1,14 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare - API jsCalendar setup (set up jsCalendar with user prefs) * * eGroupWare - API jsCalendar setup (set up jsCalendar with user prefs)
* http://www.eGroupWare.org * *
* Modified by Ralf Becker <RalfBecker@outdoor-training.de> * * @link http://www.egroupware.org
* This file is derived from jscalendar's calendar-setup.js file and the * * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* english translation in lang/calendar-en.js. * * @package api
* -------------------------------------------- * * @subpackage tools
* This program is free software; you can redistribute it and/or modify it * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* under the terms of the GNU General Public License as published by the * * @version $Id$
* Free Software Foundation; either version 2 of the License, or (at your * */
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$GLOBALS['egw_info'] = array( $GLOBALS['egw_info'] = array(
'flags' => Array( 'flags' => Array(
@ -58,8 +54,6 @@ $jsLongDateFormat = '%a, '.($dayFirst ? '%e' : '%b').($dateformat[1] == '.' ? '.
* than modifying calendar.js itself). * than modifying calendar.js itself).
*/ */
// $Id$
/** /**
* This function "patches" an input field (or other element) to use a calendar * This function "patches" an input field (or other element) to use a calendar
* widget for date selection. * widget for date selection.
@ -260,8 +254,12 @@ if(is_null($substr)) $substr = function_exists('mb_substr') ? 'mb_substr' : 'sub
$chars_shortcut = (int) lang('3 number of chars for day-shortcut'); // < 0 to take the chars from the end $chars_shortcut = (int) lang('3 number of chars for day-shortcut'); // < 0 to take the chars from the end
foreach($day2int as $name => $n) foreach($day2int as $name => $n)
{ {
echo "\n \"".($chars_shortcut > 0 ? $substr(lang($name),0,$chars_shortcut) : $short = lang($m = substr($name,0,3)); // test if our lang-file have a translation for the english short with 3 chars
$substr(lang($name),$chars_shortcut)).'"'.($n < 6 ? ',' : ''); if ($short == $m || $substr($short,-1) == '*') // else create one by truncating the full translation to x chars
{
$short = $chars_shortcut > 0 ? $substr(lang($name),0,$chars_shortcut) : $substr(lang($name),$chars_shortcut);
}
echo "\n \"".$short.'"'.($n < 6 ? ',' : '');
} }
?>); ?>);
Calendar._SDN_len = <?php echo abs((int) lang('3 number of chars for day-shortcut')); ?>; Calendar._SDN_len = <?php echo abs((int) lang('3 number of chars for day-shortcut')); ?>;
@ -277,7 +275,6 @@ foreach($monthnames as $n => $name)
Calendar._SMN = new Array Calendar._SMN = new Array
(<?php // short month names (<?php // short month names
$monthnames = array('January','February','March','April','May','June','July','August','September','October','November','December');
$chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end $chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end
foreach($monthnames as $n => $name) foreach($monthnames as $n => $name)
{ {