CodeWF.Toolkit.Lang
1.1.10
dotnet add package CodeWF.Toolkit.Lang --version 1.1.10
NuGet\Install-Package CodeWF.Toolkit.Lang -Version 1.1.10
<PackageReference Include="CodeWF.Toolkit.Lang" Version="1.1.10" />
<PackageVersion Include="CodeWF.Toolkit.Lang" Version="1.1.10" />
<PackageReference Include="CodeWF.Toolkit.Lang" />
paket add CodeWF.Toolkit.Lang --version 1.1.10
#r "nuget: CodeWF.Toolkit.Lang, 1.1.10"
#:package CodeWF.Toolkit.Lang@1.1.10
#addin nuget:?package=CodeWF.Toolkit.Lang&version=1.1.10
#tool nuget:?package=CodeWF.Toolkit.Lang&version=1.1.10
CodeWF.Toolkit.Lang
UI 无关的国际化引擎:JSON / XML / RESX 资源、运行时语言切换、父文化回退与库级嵌入资源。UI-independent localization with JSON, XML and RESX resources, culture fallback and runtime language switching.
安装
dotnet add package CodeWF.Toolkit.Lang
仅依赖 .NET BCL,无 UI 或第三方运行时依赖;目标框架 net10.0。
初始化(应用只做一次)
using CodeWF.Toolkit.Lang;
using CodeWF.Toolkit.Lang.Json;
var plugin = new JsonLangPlugin { ResourceFolder = Path.Combine(AppContext.BaseDirectory, "I18n") };
I18nManager.Instance.Register(plugin, new CultureInfo("en-US"));
I18nManager.Instance.Culture = new CultureInfo("zh-CN");
var text = I18nManager.Instance.GetResource("App.Title");
JSON 保持现有格式:language、description、cultureName 为元数据,其余对象路径组成稳定资源键。JsonLangPlugin<TLanguage>、XmlLangPlugin<TLanguage>、ResxLangPlugin<TLanguage> 支持已有语言元数据子类。
库内嵌资源
NuGet 库用 new JsonLocalizer(typeof(MyLibrary).Assembly) 读取 EmbeddedResource 嵌入的 JSON,无需调用方先注册:跟随全局语言或当前 UI 文化,按 请求文化 → 父文化 → 默认 en-US 回退;空翻译保留,缺失键返回键本身。
同键优先级:业务输出资源 > 外层库内嵌资源 > 内层依赖库内嵌资源。显式合并多个库时,AddResource(innerAssembly, outerAssembly) 按内层到外层注册;业务输出资源始终优先,宿主无需为每个库提供 resolver 或复制库资源。
注意事项
- 裁剪或 NativeAOT 应用使用显式程序集或
ResourceManager注册,避免 RESX 约定扫描。 - 全进程只有
I18nManager.Instance一个管理器;Avalonia 绑定(CodeWF.Avalonia.Lang)直接订阅该实例。
文档
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (17)
Showing the top 5 NuGet packages that depend on CodeWF.Toolkit.Lang:
| Package | Downloads |
|---|---|
|
CodeWF.Avalonia.Lang
Avalonia 国际化绑定:I18n 标记扩展与转换器,直接使用 CodeWF.Toolkit.Lang 唯一管理器、资源加载器与文化回退。Avalonia localization bindings for the shared CodeWF.Toolkit.Lang engine. |
|
|
CodeWF.Avalonia.Controls
Avalonia 基础自定义控件库:控件 API、状态模型、绘制逻辑、标记扩展与转换器,内置 Semi 主题资源(引导、传输列表、状态徽标、标题栏等)。Core custom control library for Avalonia with built-in Semi theme resources. |
|
|
CodeWF.Avalonia.Markdown.Lite
Markdown 渲染基础包:基于 Avalonia 与 Markdig 的解析渲染引擎,只渲染常规元素(标题/段落/列表/引用/表格/链接/代码块单色/图片替代文本/公式原文),并内置 18 套排版主题。Markdown rendering engine with built-in typography themes, no heavy capability dependencies. |
|
|
CodeWF.Avalonia.Markdown
Markdown 完整包:在 Lite 渲染引擎之上提供图片(GIF/SVG/预览)、数学公式、Mermaid 图表、TextMate 代码高亮、行内样式(span style 字号/前景色/背景色,含选区浮动条与可读性回退)、PNG/PDF/Word/公众号 HTML 导出,以及源码编辑器与单栏实时编辑(所见即所得)控件,并内置能力控件主题。Full Markdown package: images, math, mermaid, highlighting, inline span styles (font size / foreground / background with selection bar and readability fallback), export and editors on top of the Lite engine. |
|
|
CodeWF.Avalonia.Log
面向 Avalonia 的日志查看控件与桌面通知:基于轻量日志核心展示实时日志、级别过滤与界面友好内容,适合桌面应用内嵌日志观察台。Avalonia log viewer control with desktop notifications on top of the lightweight logging core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.10 | 136 | 11/20/2026 |
| 1.1.9 | 181 | 11/16/2026 |
| 1.1.8 | 216 | 11/16/2026 |
| 1.1.7 | 279 | 11/16/2026 |
| 1.1.6 | 1,891 | 11/8/2026 |
| 1.1.5 | 164 | 11/8/2026 |
| 1.1.4 | 349 | 11/8/2026 |
| 1.1.3 | 167 | 11/8/2026 |
| 1.1.2 | 512 | 11/1/2026 |
| 1.1.1 | 330 | 10/26/2026 |
| 1.1.0 | 673 | 10/22/2026 |
| 1.1.0-alpha.1 | 129 | 10/21/2026 |
| 1.0.0.27 | 286 | 10/19/2026 |
| 1.0.0.26 | 286 | 10/16/2026 |
| 1.0.0.25 | 202 | 10/16/2026 |
| 1.0.0.24 | 193 | 10/15/2026 |
| 1.0.0.23 | 187 | 10/15/2026 |
| 1.0.0.22 | 188 | 10/15/2026 |
| 1.0.0.20 | 185 | 10/15/2026 |
| 1.0.0.19 | 5,487 | 10/15/2026 |