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

@@ -6,11 +6,12 @@ Grocy.Components.BatteryCard.Refresh = function(batteryId)
function(batteryDetails)
{
$('#batterycard-battery-name').text(batteryDetails.battery.name);
$('#batterycard-battery-used_in').text(batteryDetails.battery.used_in);
$('#batterycard-battery-last-charged').text((batteryDetails.last_charged || 'never'));
$('#batterycard-battery-last-charged-timeago').text($.timeago(batteryDetails.last_charged || ''));
$('#batterycard-battery-charge-cycles-count').text((batteryDetails.charge_cycles_count || '0'));
EmptyElementWhenMatches('#batterycard-battery-last-charged-timeago', 'NaN years ago');
EmptyElementWhenMatches('#batterycard-battery-last-charged-timeago', L('timeago_nan'));
},
function(xhr)
{

View File

@@ -9,11 +9,12 @@ $(function()
calendarWeeks: true,
orientation: 'bottom auto',
weekStart: 1,
showOnFocus: false
showOnFocus: false,
language: L('bootstrap_datepicker_locale')
});
$('.datepicker').trigger('change');
EmptyElementWhenMatches('#datepicker-timeago', 'NaN years ago');
EmptyElementWhenMatches('#datepicker-timeago', L('timeago_nan'));
});
$('.datepicker').on('keydown', function(e)
@@ -82,7 +83,7 @@ $('.datepicker').on('change', function(e)
}
$('#datepicker-timeago').text($.timeago($('.datepicker').val()));
EmptyElementWhenMatches('#datepicker-timeago', 'NaN years ago');
EmptyElementWhenMatches('#datepicker-timeago', L('timeago_nan'));
});
$('#datepicker-button').on('click', function(e)

View File

@@ -5,6 +5,7 @@ $(function()
format: 'YYYY-MM-DD HH:mm:ss',
showTodayButton: true,
calendarWeeks: true,
maxDate: moment()
maxDate: moment(),
locale: moment.locale('de')
});
});

View File

@@ -10,7 +10,7 @@ Grocy.Components.HabitCard.Refresh = function (habitId)
$('#habitcard-habit-last-tracked-timeago').text($.timeago(habitDetails.last_tracked || ''));
$('#habitcard-habit-tracked-count').text((habitDetails.tracked_count || '0'));
EmptyElementWhenMatches('#habitcard-habit-last-tracked-timeago', 'NaN years ago');
EmptyElementWhenMatches('#habitcard-habit-last-tracked-timeago', L('timeago_nan'));
},
function(xhr)
{

View File

@@ -9,13 +9,13 @@ Grocy.Components.ProductCard.Refresh = function(productId)
$('#productcard-product-stock-amount').text(productDetails.stock_amount || '0');
$('#productcard-product-stock-qu-name').text(productDetails.quantity_unit_stock.name);
$('#productcard-product-stock-qu-name2').text(productDetails.quantity_unit_stock.name);
$('#productcard-product-last-purchased').text((productDetails.last_purchased || 'never').substring(0, 10));
$('#productcard-product-last-purchased').text((productDetails.last_purchased || L('never')).substring(0, 10));
$('#productcard-product-last-purchased-timeago').text($.timeago(productDetails.last_purchased || ''));
$('#productcard-product-last-used').text((productDetails.last_used || 'never').substring(0, 10));
$('#productcard-product-last-used').text((productDetails.last_used || L('never')).substring(0, 10));
$('#productcard-product-last-used-timeago').text($.timeago(productDetails.last_used || ''));
EmptyElementWhenMatches('#productcard-product-last-purchased-timeago', 'NaN years ago');
EmptyElementWhenMatches('#productcard-product-last-used-timeago', 'NaN years ago');
EmptyElementWhenMatches('#productcard-product-last-purchased-timeago', L('timeago_nan'));
EmptyElementWhenMatches('#productcard-product-last-used-timeago', L('timeago_nan'));
},
function(xhr)
{