Make date picker translatable
This commit is contained in:
@@ -2,6 +2,7 @@ define(
|
|||||||
[
|
[
|
||||||
'react',
|
'react',
|
||||||
'jquery',
|
'jquery',
|
||||||
|
'underscore',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
'form/fields/checkbox.jsx',
|
'form/fields/checkbox.jsx',
|
||||||
'form/fields/select.jsx',
|
'form/fields/select.jsx',
|
||||||
@@ -10,6 +11,7 @@ define(
|
|||||||
function(
|
function(
|
||||||
React,
|
React,
|
||||||
jQuery,
|
jQuery,
|
||||||
|
_,
|
||||||
MailPoet,
|
MailPoet,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Select,
|
Select,
|
||||||
@@ -21,6 +23,68 @@ define(
|
|||||||
defaultDateTime = window.mailpoet_current_date + ' ' + '00:00:00';
|
defaultDateTime = window.mailpoet_current_date + ' ' + '00:00:00';
|
||||||
timeOfDayItems = window.mailpoet_schedule_time_of_day;
|
timeOfDayItems = window.mailpoet_schedule_time_of_day;
|
||||||
|
|
||||||
|
var datepickerTranslations = {
|
||||||
|
closeText: MailPoet.I18n.t('close'),
|
||||||
|
currentText: MailPoet.I18n.t('today'),
|
||||||
|
nextText: MailPoet.I18n.t('next'),
|
||||||
|
prevText: MailPoet.I18n.t('previous'),
|
||||||
|
monthNames: [
|
||||||
|
MailPoet.I18n.t('january'),
|
||||||
|
MailPoet.I18n.t('february'),
|
||||||
|
MailPoet.I18n.t('march'),
|
||||||
|
MailPoet.I18n.t('april'),
|
||||||
|
MailPoet.I18n.t('may'),
|
||||||
|
MailPoet.I18n.t('june'),
|
||||||
|
MailPoet.I18n.t('july'),
|
||||||
|
MailPoet.I18n.t('august'),
|
||||||
|
MailPoet.I18n.t('september'),
|
||||||
|
MailPoet.I18n.t('october'),
|
||||||
|
MailPoet.I18n.t('november'),
|
||||||
|
MailPoet.I18n.t('december')
|
||||||
|
],
|
||||||
|
monthNamesShort: [
|
||||||
|
MailPoet.I18n.t('januaryShort'),
|
||||||
|
MailPoet.I18n.t('februaryShort'),
|
||||||
|
MailPoet.I18n.t('marchShort'),
|
||||||
|
MailPoet.I18n.t('aprilShort'),
|
||||||
|
MailPoet.I18n.t('mayShort'),
|
||||||
|
MailPoet.I18n.t('juneShort'),
|
||||||
|
MailPoet.I18n.t('julyShort'),
|
||||||
|
MailPoet.I18n.t('augustShort'),
|
||||||
|
MailPoet.I18n.t('septemberShort'),
|
||||||
|
MailPoet.I18n.t('octoberShort'),
|
||||||
|
MailPoet.I18n.t('novemberShort'),
|
||||||
|
MailPoet.I18n.t('decemberShort')
|
||||||
|
],
|
||||||
|
dayNames: [
|
||||||
|
MailPoet.I18n.t('sunday'),
|
||||||
|
MailPoet.I18n.t('monday'),
|
||||||
|
MailPoet.I18n.t('tuesday'),
|
||||||
|
MailPoet.I18n.t('wednesday'),
|
||||||
|
MailPoet.I18n.t('thursday'),
|
||||||
|
MailPoet.I18n.t('friday'),
|
||||||
|
MailPoet.I18n.t('saturday')
|
||||||
|
],
|
||||||
|
dayNamesShort: [
|
||||||
|
MailPoet.I18n.t('sundayShort'),
|
||||||
|
MailPoet.I18n.t('mondayShort'),
|
||||||
|
MailPoet.I18n.t('tuesdayShort'),
|
||||||
|
MailPoet.I18n.t('wednesdayShort'),
|
||||||
|
MailPoet.I18n.t('thursdayShort'),
|
||||||
|
MailPoet.I18n.t('fridayShort'),
|
||||||
|
MailPoet.I18n.t('saturdayShort')
|
||||||
|
],
|
||||||
|
dayNamesMin: [
|
||||||
|
MailPoet.I18n.t('sundayMin'),
|
||||||
|
MailPoet.I18n.t('mondayMin'),
|
||||||
|
MailPoet.I18n.t('tuesdayMin'),
|
||||||
|
MailPoet.I18n.t('wednesdayMin'),
|
||||||
|
MailPoet.I18n.t('thursdayMin'),
|
||||||
|
MailPoet.I18n.t('fridayMin'),
|
||||||
|
MailPoet.I18n.t('saturdayMin')
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
var isScheduledField = {
|
var isScheduledField = {
|
||||||
name: 'isScheduled',
|
name: 'isScheduled',
|
||||||
};
|
};
|
||||||
@@ -30,8 +94,9 @@ define(
|
|||||||
var $element = jQuery(this.refs.dateInput),
|
var $element = jQuery(this.refs.dateInput),
|
||||||
that = this;
|
that = this;
|
||||||
if ($element.datepicker) {
|
if ($element.datepicker) {
|
||||||
$element.datepicker({
|
$element.datepicker(_.extend({
|
||||||
dateFormat: "yy-mm-dd",
|
dateFormat: "yy-mm-dd",
|
||||||
|
isRTL: false,
|
||||||
onSelect: function(value) {
|
onSelect: function(value) {
|
||||||
that.props.onChange({
|
that.props.onChange({
|
||||||
target: {
|
target: {
|
||||||
@@ -40,7 +105,7 @@ define(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}, datepickerTranslations));
|
||||||
|
|
||||||
this.datepickerInitialized = true;
|
this.datepickerInitialized = true;
|
||||||
}
|
}
|
||||||
|
@@ -151,5 +151,48 @@
|
|||||||
'goBackToDesign': __('go back to design'),
|
'goBackToDesign': __('go back to design'),
|
||||||
'websiteTimeIs': __("Your website’s time is"),
|
'websiteTimeIs': __("Your website’s time is"),
|
||||||
'noScheduledDateError': __('Please enter the scheduled date'),
|
'noScheduledDateError': __('Please enter the scheduled date'),
|
||||||
|
|
||||||
|
'close': __('Close'),
|
||||||
|
'today': __('Today'),
|
||||||
|
'january': __('January'),
|
||||||
|
'february': __('February'),
|
||||||
|
'march': __('March'),
|
||||||
|
'april': __('April'),
|
||||||
|
'may': __('May'),
|
||||||
|
'june': __('June'),
|
||||||
|
'july': __('July'),
|
||||||
|
'august': __('August'),
|
||||||
|
'september': __('September'),
|
||||||
|
'october': __('October'),
|
||||||
|
'november': __('November'),
|
||||||
|
'december': __('December'),
|
||||||
|
'januaryShort': __('Jan'),
|
||||||
|
'februaryShort': __('Feb'),
|
||||||
|
'marchShort': __('Mar'),
|
||||||
|
'aprilShort': __('Apr'),
|
||||||
|
'mayShort': __('May'),
|
||||||
|
'juneShort': __('Jun'),
|
||||||
|
'julyShort': __('Jul'),
|
||||||
|
'augustShort': __('Aug'),
|
||||||
|
'septemberShort': __('Sep'),
|
||||||
|
'octoberShort': __('Oct'),
|
||||||
|
'novemberShort': __('Nov'),
|
||||||
|
'decemberShort': __('Dec'),
|
||||||
|
'sundayShort': __('Sun'),
|
||||||
|
'mondayShort': __('Mon'),
|
||||||
|
'tuesdayShort': __('Tue'),
|
||||||
|
'wednesdayShort': __('Wed'),
|
||||||
|
'thursdayShort': __('Thu'),
|
||||||
|
'fridayShort': __('Fri'),
|
||||||
|
'saturdayShort': __('Sat'),
|
||||||
|
'sundayMin': __('S'),
|
||||||
|
'mondayMin': __('M'),
|
||||||
|
'tuesdayMin': __('T'),
|
||||||
|
'wednesdayMin': __('W'),
|
||||||
|
'thursdayMin': __('T'),
|
||||||
|
'fridayMin': __('F'),
|
||||||
|
'saturdayMin': __('S'),
|
||||||
|
'next': __('Next'),
|
||||||
|
'previous': __('Previous')
|
||||||
}) %>
|
}) %>
|
||||||
<% endblock %>
|
<% endblock %>
|
||||||
|
Reference in New Issue
Block a user