mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Check for missing localization strings also client side (dev mode only)
This commit is contained in:
parent
4aee175105
commit
c048f403e6
@ -236,6 +236,11 @@ Grocy.Api.Get("system/localization-strings?v=" + Grocy.Version + "&language=" +
|
|||||||
function(response)
|
function(response)
|
||||||
{
|
{
|
||||||
Grocy.Translator = new Translator(response);
|
Grocy.Translator = new Translator(response);
|
||||||
|
|
||||||
|
if (Grocy.Mode === "dev")
|
||||||
|
{
|
||||||
|
Grocy.LocalizationStrings = response.messages[""];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
@ -247,7 +252,10 @@ __t = function(text, ...placeholderValues)
|
|||||||
if (Grocy.Mode === "dev")
|
if (Grocy.Mode === "dev")
|
||||||
{
|
{
|
||||||
var text2 = text;
|
var text2 = text;
|
||||||
Grocy.Api.Post('system/log-missing-localization', { "text": text2 });
|
if (Grocy.LocalizationStrings && !Grocy.LocalizationStrings.hasOwnProperty(text2))
|
||||||
|
{
|
||||||
|
Grocy.Api.Post('system/log-missing-localization', { "text": text2 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Grocy.Translator.__(text, ...placeholderValues)
|
return Grocy.Translator.__(text, ...placeholderValues)
|
||||||
@ -257,7 +265,10 @@ __n = function(number, singularForm, pluralForm)
|
|||||||
if (Grocy.Mode === "dev")
|
if (Grocy.Mode === "dev")
|
||||||
{
|
{
|
||||||
var singularForm2 = singularForm;
|
var singularForm2 = singularForm;
|
||||||
Grocy.Api.Post('system/log-missing-localization', { "text": singularForm2 });
|
if (Grocy.LocalizationStrings && !Grocy.LocalizationStrings.hasOwnProperty(singularForm2))
|
||||||
|
{
|
||||||
|
Grocy.Api.Post('system/log-missing-localization', { "text": singularForm2 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Grocy.Translator.n__(singularForm, pluralForm, number, number)
|
return Grocy.Translator.n__(singularForm, pluralForm, number, number)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user