Skip to content

Commit d4adda1

Browse files
revert(GetJsonStringFromAssembly): merge json from entry assembly (#5302)
* 增加例子,演示入口程序重写语言资源 * 修复入口程序重写语言资源 * refactor: 重构代码 * chore: bump version 9.3.1-beta08 Co-Authored-By: Diego2098 <[email protected]> * Revert "增加例子,演示入口程序重写语言资源" This reverts commit 42252be. --------- Co-authored-by: 2248356998 qq.com <[email protected]> Co-authored-by: Diego2098 <[email protected]>
1 parent bc627f6 commit d4adda1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.3.1-beta07</Version>
4+
<Version>9.3.1-beta08</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Extensions/LocalizationOptionsExtensions.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ public static IEnumerable<IConfigurationSection> GetJsonStringFromAssembly(this
2828

2929
// 获取程序集中的资源文件
3030
var assemblies = new List<Assembly>() { assembly };
31+
32+
// 获得主程序集资源文件
33+
// 支持合并操作
34+
var entryAssembly = GetEntryAssembly();
35+
if (assembly != entryAssembly)
36+
{
37+
assemblies.Add(entryAssembly);
38+
}
39+
3140
if (option.AdditionalJsonAssemblies != null)
3241
{
3342
assemblies.AddRange(option.AdditionalJsonAssemblies);
@@ -65,6 +74,9 @@ public static IEnumerable<IConfigurationSection> GetJsonStringFromAssembly(this
6574
}
6675

6776
return config.GetChildren();
77+
78+
[ExcludeFromCodeCoverage]
79+
Assembly GetEntryAssembly() => Assembly.GetEntryAssembly() ?? assembly;
6880
}
6981

7082
private static List<Stream> GetResourceStream(this JsonLocalizationOptions option, Assembly assembly, string cultureName)

0 commit comments

Comments
 (0)