Locales: use http-accept-language or cookie (#976)

* Locales: use http-accept-language or "language"-cookie

* Add user-setting "locale"

Rename CULTURE to DEFAULT_LOCALE

* Use LocaleMiddleware also in dev mode

* CORS: don't require authentication on OPTIONS

* Use a standard user-settings-control and start a new generic user settings page, not a separate page for the locale setting

* Fixed (broken by myself) link-return handling

* Clarify language settings

* Removed unneeded files

* Better user settings icon

* Added localization hints

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
fipwmaqzufheoxq92ebc
2020-08-31 19:11:51 +02:00
committed by GitHub
parent 4a030b7ffc
commit 6f8ad9b76e
21 changed files with 383 additions and 20 deletions

View File

@@ -670,3 +670,29 @@ $(Grocy.UserPermissions).each(function(index, item)
$('.permission-' + item.permission_name).addClass('disabled').addClass('not-allowed');
}
});
$('a.link-return').not(".btn").each(function () {
var base = $(this).data('href');
if(base.contains('?'))
{
$(this).attr('href', base + '&returnto' + encodeURIComponent(location.pathname));
}
else{
$(this).attr('href', base + '?returnto=' + encodeURIComponent(location.pathname));
}
})
$(document).on("click", "a.btn.link-return", function(e)
{
e.preventDefault();
var link = GetUriParam("returnto");
if (!link || !link.length > 0)
{
location.href = $(e.currentTarget).attr("href");
}
else
{
location.href = U(link);
}
});