mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
* Calendar/API: fixed not working dateformat d-M-Y with French language (Juin=Jun, Juillet=Jui)
This commit is contained in:
parent
0db7258a7b
commit
52be51f4bf
@ -60,20 +60,20 @@ class jscalendar
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* return javascript needed for jscalendar
|
||||
*
|
||||
* Only needed if jscalendar runs outside of egw_framework, eg. in sitemgr
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_javascript()
|
||||
{
|
||||
$args = array_intersect_key($GLOBALS['egw_info']['user']['preferences']['common'],array('lang'=>1,'dateformat'=>1));
|
||||
return
|
||||
'<link rel="stylesheet" type="text/css" media="all" href="'.$this->jscalendar_url.'/calendar-blue.css" title="blue" />
|
||||
<script type="text/javascript" src="'.$this->jscalendar_url.'/calendar.js"></script>
|
||||
<script type="text/javascript" src="'.egw::link('/phpgwapi/inc/jscalendar-setup.php',$args,false).'"></script>
|
||||
*
|
||||
* Only needed if jscalendar runs outside of egw_framework, eg. in sitemgr
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_javascript()
|
||||
{
|
||||
$args = array_intersect_key($GLOBALS['egw_info']['user']['preferences']['common'],array('lang'=>1,'dateformat'=>1));
|
||||
return
|
||||
'<link rel="stylesheet" type="text/css" media="all" href="'.$this->jscalendar_url.'/calendar-blue.css" title="blue" />
|
||||
<script type="text/javascript" src="'.$this->jscalendar_url.'/calendar.js"></script>
|
||||
<script type="text/javascript" src="'.egw::link('/phpgwapi/inc/jscalendar-setup.php',$args,false).'"></script>
|
||||
';
|
||||
}
|
||||
|
||||
@ -112,13 +112,16 @@ class jscalendar
|
||||
static $chars_shortcut;
|
||||
if (is_null($chars_shortcut)) $chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end
|
||||
|
||||
$markuntranslated = translation::$markuntranslated;
|
||||
translation::$markuntranslated = true; // otherwise we can not detect NOT translated phrases!
|
||||
$short = lang($m = adodb_date('M',$ts)); // check if we have a translation of the short-cut
|
||||
if ($short == $m || $substr($short,-1) == '*') // if not generate one by truncating the translation of the long name
|
||||
if ($substr($short,-1) == '*') // if not generate one by truncating the translation of the long name
|
||||
{
|
||||
$short = $chars_shortcut > 0 ? $substr(lang(adodb_date('F',$ts)),0,$chars_shortcut) :
|
||||
$substr(lang(adodb_date('F',$ts)),$chars_shortcut);
|
||||
}
|
||||
$date = str_replace(adodb_date('M',$ts),$short,$date);
|
||||
translation::$markuntranslated = $markuntranslated;
|
||||
}
|
||||
}
|
||||
if ($helpmsg !== '')
|
||||
@ -199,7 +202,7 @@ function todayClicked(calendar) {
|
||||
split[1] = "'.egw_time::to('now','Ymd').'";
|
||||
hasdate = true;
|
||||
}
|
||||
|
||||
|
||||
if (split[1])
|
||||
newsearch += split[0] + "=" + split[1];
|
||||
else
|
||||
@ -265,6 +268,8 @@ function monthClicked(calendar,monthstart) {
|
||||
{
|
||||
return False;
|
||||
}
|
||||
$markuntranslated = translation::$markuntranslated;
|
||||
translation::$markuntranslated = true; // otherwise we can not detect NOT translated phrases!
|
||||
$fields = preg_split('/[.\\/-]/',$datestr);
|
||||
foreach(preg_split('/[.\\/-]/',$this->dateformat) as $n => $field)
|
||||
{
|
||||
@ -302,6 +307,8 @@ function monthClicked(calendar,monthstart) {
|
||||
}
|
||||
$date[$field] = (int)$fields[$n];
|
||||
}
|
||||
translation::$markuntranslated = $markuntranslated;
|
||||
|
||||
$ret = array(
|
||||
$year => $date['Y'],
|
||||
$month => $date['m'],
|
||||
|
@ -23,7 +23,7 @@ $GLOBALS['egw_info'] = array(
|
||||
);
|
||||
try {
|
||||
include('../../header.inc.php');
|
||||
}
|
||||
}
|
||||
catch (egw_exception_no_permission_app $e) {
|
||||
// ignore exception, if home is not allowed, eg. for sitemgr
|
||||
}
|
||||
@ -256,10 +256,12 @@ Calendar._SDN = new Array
|
||||
static $substr;
|
||||
if(is_null($substr)) $substr = function_exists('mb_substr') ? 'mb_substr' : 'substr';
|
||||
$chars_shortcut = (int) lang('3 number of chars for day-shortcut'); // < 0 to take the chars from the end
|
||||
$markuntranslated = translation::$markuntranslated;
|
||||
translation::$markuntranslated = true; // otherwise we can not detect NOT translated phrases!
|
||||
foreach($day2int as $name => $n)
|
||||
{
|
||||
$short = lang($m = substr($name,0,3)); // test if our lang-file have a translation for the english short with 3 chars
|
||||
if ($short == $m || $substr($short,-1) == '*') // else create one by truncating the full translation to x chars
|
||||
if ($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);
|
||||
}
|
||||
@ -270,6 +272,7 @@ Calendar._SDN_len = <?php echo abs((int) lang('3 number of chars for day-shortcu
|
||||
|
||||
Calendar._MN = new Array
|
||||
(<?php // full month names
|
||||
translation::$markuntranslated = $markuntranslated;
|
||||
$monthnames = array('January','February','March','April','May','June','July','August','September','October','November','December');
|
||||
foreach($monthnames as $n => $name)
|
||||
{
|
||||
@ -279,16 +282,18 @@ foreach($monthnames as $n => $name)
|
||||
|
||||
Calendar._SMN = new Array
|
||||
(<?php // short month names
|
||||
translation::$markuntranslated = true; // otherwise we can not detect NOT translated phrases!
|
||||
$chars_shortcut = (int)lang('3 number of chars for month-shortcut'); // < 0 to take the chars from the end
|
||||
foreach($monthnames as $n => $name)
|
||||
{
|
||||
$short = lang($m = substr($name,0,3)); // test if our lang-file have a translation for the english short with 3 chars
|
||||
if ($short == $m || $substr($short,-1) == '*') // else create one by truncating the full translation to x chars
|
||||
if ($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 < 11 ? ',' : '');
|
||||
}
|
||||
translation::$markuntranslated = $markuntranslated;
|
||||
?>);
|
||||
Calendar._SMN_len = <?php echo abs((int) lang('3 number of chars for month-shortcut')); ?>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user