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

Loading…
Cancel
Save