Added localization support

This commit is contained in:
Bernd Bestel
2018-04-16 19:11:32 +02:00
parent 4949913ccb
commit 4656a85732
64 changed files with 1112 additions and 878 deletions

View File

@@ -1,17 +1,27 @@
var Grocy = { };
Grocy.Components = { };
$(function()
L = function(text, ...placeholderValues)
{
if (!Grocy.ActiveNav.isEmpty())
var localizedText = Grocy.LocalizationStrings[text];
if (localizedText === undefined)
{
var menuItem = $('.nav').find("[data-nav-for-page='" + Grocy.ActiveNav + "']");
menuItem.addClass('active');
}
localizedText = text;
}
for (var i = 0; i < placeholderValues.length; i++)
{
localizedText = localizedText.replace('#' + (i + 1), placeholderValues[i]);
}
return localizedText;
}
$.timeago.settings.allowFuture = true;
$('time.timeago').timeago();
});
if (!Grocy.ActiveNav.isEmpty())
{
var menuItem = $('.nav').find("[data-nav-for-page='" + Grocy.ActiveNav + "']");
menuItem.addClass('active');
}
$.timeago.settings.allowFuture = true;
$('time.timeago').timeago();
Grocy.FetchJson = function(url, success, error)
{