mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Partly reverted b856911f0f0b395d3534c0f0647f4f33fe6da8ef
Loading localization strings async for the fronted currently doesn't work in all cases...
This commit is contained in:
parent
18e8fc8293
commit
8d2c3ae584
@ -129,6 +129,7 @@ class BaseController
|
||||
$this->View->set('__n', function ($number, $singularForm, $pluralForm) use ($localizationService) {
|
||||
return $localizationService->__n($number, $singularForm, $pluralForm);
|
||||
});
|
||||
$this->View->set('LocalizationStrings', $localizationService->GetPoAsJsonString());
|
||||
|
||||
// TODO: Better handle this generically based on the current language (header in .po file?)
|
||||
$dir = 'ltr';
|
||||
|
@ -231,28 +231,13 @@ U = function(relativePath)
|
||||
return Grocy.BaseUrl.replace(/\/$/, '') + relativePath;
|
||||
}
|
||||
|
||||
Grocy.Translator = new Translator(); // Dummy, real instance is loaded async below
|
||||
Grocy.Api.Get("system/localization-strings?v=" + Grocy.Version + "&language=" + Grocy.Culture,
|
||||
function(response)
|
||||
{
|
||||
Grocy.Translator = new Translator(response);
|
||||
|
||||
if (Grocy.Mode === "dev")
|
||||
{
|
||||
Grocy.LocalizationStrings = response.messages[""];
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
Grocy.Translator = new Translator(Grocy.LocalizationStrings);
|
||||
__t = function(text, ...placeholderValues)
|
||||
{
|
||||
if (Grocy.Mode === "dev")
|
||||
{
|
||||
var text2 = text;
|
||||
if (Grocy.LocalizationStrings && !Grocy.LocalizationStrings.hasOwnProperty(text2))
|
||||
if (Grocy.LocalizationStrings && !Grocy.LocalizationStrings.messages[""].hasOwnProperty(text2))
|
||||
{
|
||||
Grocy.Api.Post('system/log-missing-localization', { "text": text2 });
|
||||
}
|
||||
@ -265,7 +250,7 @@ __n = function(number, singularForm, pluralForm)
|
||||
if (Grocy.Mode === "dev")
|
||||
{
|
||||
var singularForm2 = singularForm;
|
||||
if (Grocy.LocalizationStrings && !Grocy.LocalizationStrings.hasOwnProperty(singularForm2))
|
||||
if (Grocy.LocalizationStrings && !Grocy.LocalizationStrings.messages[""].hasOwnProperty(singularForm2))
|
||||
{
|
||||
Grocy.Api.Post('system/log-missing-localization', { "text": singularForm2 });
|
||||
}
|
||||
|
@ -94,6 +94,7 @@
|
||||
Grocy.Currency = '{{ GROCY_CURRENCY }}';
|
||||
Grocy.CalendarFirstDayOfWeek = '{{ GROCY_CALENDAR_FIRST_DAY_OF_WEEK }}';
|
||||
Grocy.CalendarShowWeekNumbers = {{ BoolToString(GROCY_CALENDAR_SHOW_WEEK_OF_YEAR) }};
|
||||
Grocy.LocalizationStrings = {!! $LocalizationStrings !!};
|
||||
Grocy.FeatureFlags = {!! json_encode($featureFlags) !!};
|
||||
Grocy.Webhooks = {
|
||||
@if(GROCY_FEATURE_FLAG_LABELPRINTER && !GROCY_LABEL_PRINTER_RUN_SERVER)
|
||||
|
Loading…
x
Reference in New Issue
Block a user