Don't bail if the underlying localisation resourced is not embedded

This commit is contained in:
Dean Herbert 2021-04-21 14:37:28 +09:00
parent 60acd824cb
commit 5c8f562472
1 changed files with 10 additions and 1 deletions

View File

@ -34,7 +34,16 @@ public string Get(string lookup)
if (!resourceManagers.TryGetValue(ns, out var manager))
resourceManagers[ns] = manager = new ResourceManager(ns, GetType().Assembly);
return manager.GetString(key, EffectiveCulture);
try
{
return manager.GetString(key, EffectiveCulture);
}
catch (MissingManifestResourceException)
{
// in the case the manifest is missing, it is likely that the user is adding code-first implementations of new localisation namespaces.
// it's fine to ignore this as localisation will fallback to default values.
return null;
}
}
public Task<string> GetAsync(string lookup)