add culture based caching
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#region {0}
|
||||
|
||||
private static readonly Lazy<IResourceString> Lazy{0} = new Lazy<IResourceString>(
|
||||
() => new ResourceManagerString("{0}", {1}, CultureInfo.CurrentCulture),
|
||||
() => AddToCultureCache(new ResourceManagerString("{0}", {1}, GetDefaultCulture)),
|
||||
LazyThreadSafetyMode.PublicationOnly
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
internal static class {0}
|
||||
{{
|
||||
private static readonly Lazy<IResourceString> LazyFormat = new Lazy<IResourceString>(
|
||||
() => new ResourceManagerString("{0}", {1}, CultureInfo.CurrentCulture),
|
||||
() => AddToCultureCache(new ResourceManagerString("{0}", {1}, GetDefaultCulture)),
|
||||
LazyThreadSafetyMode.PublicationOnly
|
||||
);
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
</data>
|
||||
<data name="ResourceFormatClassFromMethod" xml:space="preserve">
|
||||
<value>
|
||||
public static IResourceString From({0}) => new FormattedResourceString(
|
||||
public static IResourceString From({0}) => AddToCultureCache(new FormattedResourceString(
|
||||
Format,
|
||||
GetDefaultCulture,
|
||||
{1}
|
||||
);
|
||||
));
|
||||
</value>
|
||||
<comment>0 = FromMethodSignature, 1 = ParameterNames</comment>
|
||||
</data>
|
||||
@@ -71,6 +72,16 @@ namespace {0}
|
||||
|
||||
public static ResourceManager ResourceManager => _ResourceManager.Value;
|
||||
|
||||
private static CultureInfo GetDefaultCulture()
|
||||
{{
|
||||
return CultureInfo.CurrentCulture;
|
||||
}}
|
||||
|
||||
private static IResourceString AddToCultureCache(IResourceString source)
|
||||
{{
|
||||
return new CultureBasedCachedString(source, GetDefaultCulture);
|
||||
}}
|
||||
|
||||
#endregion // ResourceManager
|
||||
</value>
|
||||
<comment>0 = ResourceManagerTypeName, 1 = ClassName</comment>
|
||||
|
||||
Reference in New Issue
Block a user