Skip to content

Commit

Permalink
Merge pull request #8 from dushevadnqka/add-bg-translation-and-dynami…
Browse files Browse the repository at this point in the history
…c-locale-for-fullcalendar

Bg Translation and Dynamic locale for fullcalendar
  • Loading branch information
dunglas authored Apr 9, 2020
2 parents f084319 + aa3acb8 commit cfe10df
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Resources/public/admin/collections.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
$(function () {
var config = JSON.parse($('#calendar_config').text());
var locale = config.locale.includes('_') ? config.locale.split('_')[0] : config.locale;

var calendar = new FullCalendar.Calendar($('#calendar')[0], {
plugins: [ 'timeGrid' ],
defaultView: 'timeGrid',
nowIndicator: true,
locale: locale,
});
var calendarRendered = false;

Expand Down
4 changes: 3 additions & 1 deletion src/Resources/public/click_n_collect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

$(function () {
var config = JSON.parse($('#calendar_config').text());
var locale = config.locale.includes('_') ? config.locale.split('_')[0] : config.locale;
$('input.click_n_collect_location').each(function () {
var n = $(this).attr('id').match(/sylius_checkout_select_shipping_shipments_([0-9]+)_location/)[1];

Expand Down Expand Up @@ -30,7 +31,8 @@ $(function () {
eventClick: function (info) {
$collectionTime.val(info.event.start.toISOString());
selectEvent(info.el);
}
},
locale: locale,
});
var calendarRendered = false;

Expand Down
49 changes: 49 additions & 0 deletions src/Resources/translations/messages.bg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
coop_tilleuls_click_n_collect:
menu:
admin:
main:
sales:
collections: Click 'N' Collect
configuration:
locations: Локации за Click 'N' Collect
ui:
new_location: Нова локация за Click 'N' Collect
edit_location: Промени локация за Click 'N' Collect
locations: Локации за Click 'N' Collect
collect_details: Детайли за получаване
pin: 'ПИН-код:'
collections: Click 'N' Collect
change_collection_time: Промяна време за получаване
form:
location:
name: име
rrule: Правило за повторение на работното време (формат iCalendar)
rrule_interval: интервал на получаване
rrule_hoursly: Часове
rrule_minutely: Минути
rrule_days: Дни от седмицата
rrule_weekdays:
monday: Пон.
tuesday: Вто.
wednesday: Сря.
thursday: Четв.
friday: Пет.
saturday: Съб.
sunday: Нед.
rrule_schedule: Работно време
rrule_dtstart: Начална дата
rrule_expert: Начин за напреднали
rrule_toggle: Смени
order_preparation_delay: Време за приготвяне на поръчката (в минути)
throughput: Поток (колко човека едновременно могат да бъдат обслужени)
generate_pin: Активирай ПИН-код операции?
street: Улица
city: Град
postcode: Пощ. код
country: Държава
province_code: Код на област
province_name: име на област
enabled: Включено
shipping_method:
click_n_collect: Click 'N' Collect
locations: Локации за Click 'N' Collect
4 changes: 4 additions & 0 deletions src/Resources/views/Admin/collections.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
{% for location in locations %}<option value="{{ location.code|escape('html_attr') }}">{{ location.name }}</option>{% endfor %}
</select>
<div id="calendar"></div>
{# json_encode(65) is for JSON_UNESCAPED_SLASHES|JSON_HEX_TAG to avoid JS XSS #}
<script type="application/json" id="calendar_config">{{ {
locale: app.request.locale,
}|json_encode(65)|raw }}</script>
</div>
{% endblock %}

Expand Down
1 change: 1 addition & 0 deletions src/Resources/views/fullcalendar/_scripts.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{# TODO: use a local installation and Webpack Encore, need https://github.com/Sylius/Sylius/issues/10656 #}
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'https://unpkg.com/@fullcalendar/core@^4/locales-all.js'} %}
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'https://unpkg.com/@fullcalendar/core@^4/main.js'} %}
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'https://unpkg.com/@fullcalendar/daygrid@^4/main.js'} %}
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'https://unpkg.com/@fullcalendar/timegrid@^4/main.js'} %}

0 comments on commit cfe10df

Please sign in to comment.