Get current locale from the lang HTML attribute

The language attribute is present in all layouts since commit 025923ac4,
so there's no need to use the language selector locale. Besides, it
wouldn't work if there's only one locale and the language selector isn't
shown.
This commit is contained in:
Javi Martín
2021-06-24 23:55:15 +02:00
parent 3b71974920
commit 554bc926c7
2 changed files with 2 additions and 2 deletions

View File

@@ -17,7 +17,7 @@
App.Datepicker = {
initialize: function() {
var locale;
locale = $("#js-locale").data("current-locale");
locale = document.documentElement.lang;
$(".js-calendar").datepicker({
maxDate: "+0d"
});

View File

@@ -1,5 +1,5 @@
<% if I18n.available_locales.size > 1 %>
<div class="locale" id="js-locale" data-current-locale="<%= I18n.locale %>">
<div class="locale">
<form class="locale-form">
<label class="inline-block" for="locale-switcher">
<%= t("layouts.header.locale") %>