Browse Source

More stable localizer for tests.

pull/592/head
Sebastian 5 years ago
parent
commit
bfab313751
  1. 25
      backend/src/Squidex.Infrastructure/Translations/ResourcesLocalizer.cs

25
backend/src/Squidex.Infrastructure/Translations/ResourcesLocalizer.cs

@ -28,15 +28,26 @@ namespace Squidex.Infrastructure.Translations
this.resourceManager = resourceManager;
#if DEBUG
missingTranslations = new HashSet<string>();
for (var i = 0; i < 3; i++)
{
lock (LockObject)
{
try
{
if (File.Exists(MissingFileName))
{
var missing = File.ReadAllLines(MissingFileName);
missingTranslations = new HashSet<string>(missing);
}
else
}
catch (IOException)
{
missingTranslations = new HashSet<string>();
continue;
}
}
}
#endif
}
@ -171,13 +182,23 @@ namespace Squidex.Infrastructure.Translations
if (translation == null)
{
#if DEBUG
for (var i = 0; i < 3; i++)
{
lock (LockObject)
{
try
{
if (!missingTranslations.Add(key))
{
File.AppendAllLines(MissingFileName, new[] { key });
}
}
catch (IOException)
{
continue;
}
}
}
#endif
}

Loading…
Cancel
Save