N°1053: Set the first day of the week on date/time picker to a language based setting

* Update moment.js
* Add locales to moment.js
* Align console & portal on the same moment.js library
This commit is contained in:
steffunky
2018-11-06 11:05:28 +01:00
parent e4619fbc0f
commit 00bd7583f7
20 changed files with 25 additions and 17 deletions

View File

@@ -104,7 +104,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_linked_script('../js/jquery.mousewheel.js');
$this->add_linked_script('../js/jquery.magnific-popup.min.js');
$this->add_linked_script('../js/breadcrumb.js');
$this->add_linked_script('../js/moment.min.js');
$this->add_linked_script('../js/moment-with-locales.min.js');
$this->add_dict_entry('UI:FillAllMandatoryFields');

View File

@@ -66,6 +66,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array(
'Portal:File:None' => 'No file',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>',
'Portal:Calendar-FirstDayOfWeek' => 'cs', //work with moment.js locales
));
// UserProfile brick

View File

@@ -64,6 +64,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array(
'Portal:File:None' => 'No file~~',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>~~',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>~~',
'Portal:Calendar-FirstDayOfWeek' => 'da', //work with moment.js locales
));
// UserProfile brick

View File

@@ -63,6 +63,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array(
'Portal:File:None' => 'Kein File vorhanden',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Öffnen</a> / <a href="%4$s" class="file_download_link">Download</a>',
'Portal:Calendar-FirstDayOfWeek' => 'de', //work with moment.js locales
));
// UserProfile brick

View File

@@ -64,6 +64,7 @@ Dict::Add('EN US', 'English', 'English', array(
'Portal:File:None' => 'No file',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>',
'Portal:Calendar-FirstDayOfWeek' => 'en-us', //work with moment.js locales
));
// UserProfile brick

View File

@@ -62,6 +62,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', array(
'Portal:File:None' => 'No hay archivo',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Abierto</a> / <a href="%4$s" class="file_download_link">Download</a>',
'Portal:Calendar-FirstDayOfWeek' => 'es', //work with moment.js locales
));
// UserProfile brick

View File

@@ -62,6 +62,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
'Portal:File:None' => 'Aucun fichier',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Ouvrir</a> / <a href="%4$s" class="file_download_link">Télécharger</a>',
'Portal:Calendar-FirstDayOfWeek' => 'fr', //work with moment.js locales
));
// UserProfile brick

View File

@@ -64,6 +64,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'Portal:File:None' => 'No file~~',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>~~',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>~~',
'Portal:Calendar-FirstDayOfWeek' => 'hu', //work with moment.js locales
));
// UserProfile brick

View File

@@ -64,6 +64,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array(
'Portal:File:None' => 'No file~~',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>~~',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>~~',
'Portal:Calendar-FirstDayOfWeek' => 'it', //work with moment.js locales
));
// UserProfile brick

View File

@@ -64,6 +64,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array(
'Portal:File:None' => 'No file~~',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>~~',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>~~',
'Portal:Calendar-FirstDayOfWeek' => 'ja', //work with moment.js locales
));
// UserProfile brick

View File

@@ -62,6 +62,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
'Portal:File:None' => 'No file~~',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>~~',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>~~',
'Portal:Calendar-FirstDayOfWeek' => 'nl', //work with moment.js locales
));
// UserProfile brick

View File

@@ -99,8 +99,8 @@
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/jquery-visible/js/jquery.visible.min.js'|add_itop_version }}"></script>
{# Base64.js #}
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/jquery-base64/js/jquery.base64.min.js'|add_itop_version }}"></script>
{# Moment.js #}
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/moment/js/moment.min.js'|add_itop_version }}"></script>
{# Moment.js with locales#}
<script type="text/javascript" src="{{ app['combodo.absolute_url'] ~ 'js/moment-with-locales.min.js'|add_itop_version }}"></script>
{# Datatables #}
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/datatables/js/jquery.dataTables.min.js'|add_itop_version }}"></script>
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/datatables/js/dataTables.bootstrap.min.js'|add_itop_version }}"></script>

File diff suppressed because one or more lines are too long

View File

@@ -62,6 +62,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
'Portal:File:None' => 'Nenhum arquivo',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Abrir</a> / <a href="%4$s" class="file_download_link">Download</a>',
'Portal:Calendar-FirstDayOfWeek' => 'pt-br', //work with moment.js locales
));
// UserProfile brick

View File

@@ -51,6 +51,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array(
'Portal:File:None' => 'No file~~',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>~~',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>~~',
'Portal:Calendar-FirstDayOfWeek' => 'ru', //work with moment.js locales
));
// UserProfile brick

View File

@@ -64,6 +64,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
'Portal:File:None' => 'No file~~',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>~~',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>~~',
'Portal:Calendar-FirstDayOfWeek' => 'tr', //work with moment.js locales
));
// UserProfile brick

View File

@@ -64,6 +64,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array(
'Portal:File:None' => 'No file~~',
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>~~',
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Open</a> / <a href="%4$s" class="file_download_link">Download</a>~~',
'Portal:Calendar-FirstDayOfWeek' => 'zh-cn', //work with moment.js locales
));
// UserProfile brick

6
js/moment-with-locales.min.js vendored Normal file

File diff suppressed because one or more lines are too long

7
js/moment.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -91,9 +91,10 @@ class BsSimpleFieldRenderer extends FieldRenderer
$oOutput->AddHtml('<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>');
$oOutput->AddHtml('</div>');
$sJSFormat = json_encode($this->oField->GetJSDateTimeFormat());
$sLocale = Dict::S('Portal:Calendar-FirstDayOfWeek');
$oOutput->AddJs(
<<<EOF
$('#datepicker_{$this->oField->GetGlobalId()}').datetimepicker({format: $sJSFormat});
$('#datepicker_{$this->oField->GetGlobalId()}').datetimepicker({format: $sJSFormat, locale: '$sLocale'});
EOF
);
break;