VintaSoft Imaging .NET SDK 可以本地化为任何语言。
该 SDK 包含本地化的 VintaSoft .NET 程序集和 VintaSoft WinForms 演示项目,这些项目已本地化为德语,以此展示 SDK 可以本地化为任何语言。
此外,SDK 还包含本地化的 VintaSoft ASP.NET Core 演示项目,这些项目已本地化为 32 种语言,以此示例说明 Web SDK 解决方案可以本地化为任何语言。
如果您想本地化 VintaSoft .NET 程序集的字符串常量和 UI 控件,请阅读"本地化 VintaSoft"中的操作方法。本文的"本地化 VintaSoft WinForms 演示项目"部分介绍了如何本地化 VintaSoft WinForms 演示项目的字符串常量和 UI。
如果您想本地化 VintaSoft WinForms 演示项目的字符串常量和 UI,请阅读本文"本地化 VintaSoft ASP.NET 演示项目"部分了解具体操作方法。
如果您想本地化 VintaSoft ASP.NET 演示项目的字符串常量和 UI,请阅读本文"本地化 VintaSoft ASP.NET 演示项目"部分了解具体操作方法。
本地化 VintaSoft .NET 程序集
所有 VintaSoft .NET 程序集均支持英文本地化。
此外,VintaSoft Imaging .NET SDK 还支持将以下 VintaSoft .NET 程序集(使用附属资源程序集)本地化为任何语言:
- Vintasoft.Imaging.dll
- Vintasoft.Imaging.UI.dll
- Vintasoft.Imaging.Annotation.Dicom.dll
- Vintasoft.Imaging.Annotation.Dicom.UI.dll
- Vintasoft.Imaging.Annotation.Dicom.Wpf.UI.dll
- Vintasoft.Imaging.Dicom.dll
- Vintasoft.Imaging.Dicom.Mpr.dll
- Vintasoft.Imaging.Dicom.Mpr.UI.dll
- Vintasoft.Imaging.Dicom.Mpr.Wpf.UI.dll
- Vintasoft.Imaging.Dicom.UI.dll
- Vintasoft.Imaging.Dicom.Wpf.UI.dll
- Vintasoft.Imaging.Pdf.dll
- Vintasoft.Imaging.Pdf.JavaScript.dll
- Vintasoft.Imaging.Pdf.UI.dll
- Vintasoft.Imaging.Pdf.Wpf.UI.dll
如果您想本地化 VintaSoft如果上述列表中没有您需要的 .NET 程序集,请告知我们,我们将为您提供本地化所需 Vintasoft .NET 程序集的功能。
VintaSoft Imaging .NET SDK 安装程序会提供德语的附属程序集,这些程序集位于"{SdkInstallPath}\Imaging .NET v12.2\Bin\DotNetX\AnyCPU\de\"文件夹中。
如果您想本地化上述列表中的 VintaSoft .NET 程序集,例如 Vintasoft.Imaging.Pdf.dll,则应执行以下步骤:
-
从 Vintasoft.Imaging.Pdf.dll 程序集中提取包含常量字符串的"Vintasoft.Imaging.Pdf.Localization.Strings.resources"资源文件。
以下是 .NET 控制台应用程序的 C# 代码,该代码允许从 Vintasoft.Imaging.Pdf.dll 程序集中提取"Vintasoft.Imaging.Pdf.Localization.Strings.resources"资源文件:
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
string dotNetAssemblyFileName = @"D:\VintaSoft\Imaging .NET v12.2\Bin\DotNet7\AnyCPU\Vintasoft.Imaging.Pdf.dll";
string resourceFileName = "Vintasoft.Imaging.Pdf.Localization.Strings.resources";
ExtractBinaryResourceFromDotNetAssembly(dotNetAssemblyFileName, resourceFileName);
}
static void ExtractBinaryResourceFromDotNetAssembly(string dotNetAssemblyFileName, string resourceFileName)
{
System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFile(dotNetAssemblyFileName);
System.IO.Stream resourceStream = assembly.GetManifestResourceStream(resourceFileName);
byte[] resourceStreamBytes = new byte[resourceStream.Length];
resourceStream.Read(resourceStreamBytes, 0, resourceStreamBytes.Length);
System.IO.File.WriteAllBytes(resourceFileName, resourceStreamBytes);
}
}
}
-
将提取的"Vintasoft.Imaging.Pdf.Localization.Strings.resources"资源文件转换为 .resx 文件。可以使用 ResGen 工具完成此操作。
以下命令行可以将 .NET 二进制资源文件转换为 .resx 文件:
"{Path_to_ResGen.exe_file}\ResGen.exe" Vintasoft.Imaging.Pdf.Localization.Strings.resources Strings.resx
-
创建一个名为 Strings.resx 的文件,其中包含已翻译成所需语言(例如西班牙语)的常量字符串:
- 将 String.resx 文件重命名为 Strings.es.resx 文件。
- 使用任何文本编辑器打开 Strings.es.resx 文件,并将字符串常量("value"标签中的字符串)从英语翻译成西班牙语。
-
创建包含已翻译常量字符串的卫星程序集:
- 创建"Vintasoft.Imaging.Pdf.es.resources"文件夹并进入该文件夹。
-
使用任意文本编辑器创建"Vintasoft.Imaging.Pdf.csproj"文件,并将以下文本添加到创建的文件中:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
- 创建"Localization"文件夹并进入该文件夹。
- 将Strings.es.resx文件复制到"Localization"文件夹。
- 进入"Vintasoft.Imaging.Pdf.es.resources"文件夹。
-
使用以下命令编译项目:
dotnet build Vintasoft.Imaging.Pdf.csproj
- 将在"bin\Debug\net7.0\es\"文件夹中创建附属程序集"Vintasoft.Imaging.Pdf.resources.dll"。
-
将附属程序集与 Vintasoft.Imaging.Pdf.dll 程序集一起使用:
本地化 VintaSoft WinForms 演示项目
如果您想本地化 WinForms 项目,应执行以下步骤:
-
本地化项目中使用的 WinForms 窗体的 UI:
-
对于项目中的每个 WinForms 窗体:
- 在 Visual Studio 的 WinForms 设计器中打开 WinForms 窗体。
- 将窗体的"Localizable"属性设置为 True。
- 将表单的"Language"属性设置为所需语言,例如西班牙语,=> 设计器将创建 FormName.es.resx 文件,其中包含有关表单西班牙语本地化的信息。
- 本地化表单的 UI 元素,并将本地化信息保存到 FormName.es.resx 文件中。
-
本地化项目源代码中使用的字符串常量:
- 在项目中创建"Localization"文件夹。
- 将名为"Strings.resx"的资源文件添加到"Localization"文件夹。
-
对于每个常量字符串在项目代码中:
- 将常量字符串添加到 Strings.resx 资源文件中。
- 将项目代码中的常量字符串替换为访问 Strings.resx 资源文件中常量字符串的代码。
所有 VintaSoft WinForms 演示项目均已本地化为英文。
SDK 还为 3 个 VintaSoft WinForms 演示项目(DicomViewerDemo、PdfEditorDemo 和 SpreadsheetEditorDemo)提供了德语本地化,以此为例说明 VintaSoft WinForms 演示项目可以本地化为任何语言。
如果您想本地化一个已经本地化的 VintaSoft WinForms 演示项目(例如,已本地化为德语),则应执行以下步骤:
- 按照上述 WinForms 项目本地化说明中的方法,本地化项目中使用的 WinForms 窗体的 UI。
-
本地化项目源代码中使用的字符串常量:
- 创建"Localization\Strings.resx"文件的副本 => 将创建"Strings - Copy.resx"和"Strings - Copy.Designer.cs"文件。
- 删除"Strings - Copy.Designer.cs"文件。
- 将"Strings - Copy.resx"文件重命名为"Strings.es.resx"文件。
- 在 Visual Studio 的资源设计器中打开"Strings.es.resx"文件,并将字符串常量从英文翻译成西班牙文。
如果您想本地化一个当前尚未本地化的 VintaSoft WinForms 演示项目,您可以通过两种方式进行。
方式 1:按照上述 WinForms 项目本地化说明中的方法本地化 VintaSoft WinForms 演示项目。
方式 2:向我们发送将 VintaSoft WinForms 演示项目本地化为所需语言的请求,我们将尽力协助您完成本地化。
本地化 VintaSoft ASP.NET 演示项目
每个 VintaSoft ASP.NET 演示项目都包含两部分:JavaScript UI 控件,用于定义 Web 应用程序的 UI 和逻辑;以及 VintaSoft Web 服务,用于处理来自 JavaScript UI 控件的请求并使用 VintaSoft Imaging .NET SDK 的功能。
"VintaSoft ASP.NET Core Document Viewer Demo"提供了即用型本地化词典,可以将
VintaSoft Web 文档查看器本地化为 32 种语言(南非荷兰语、阿拉伯语、白俄罗斯语、保加利亚语、中文、克罗地亚语、捷克语、丹麦语、荷兰语、英语、芬兰语、法语、德语、希腊语、希伯来语、印地语、匈牙利语、意大利语、日语、韩语、挪威语、葡萄牙语、罗马尼亚语、俄语、斯洛伐克语、斯洛文尼亚语、西班牙语、斯瓦希里语、瑞典语、土耳其语、越南语、祖鲁语)。您可以使用
VintaSoft ASP.NET Core 文档查看器演示的在线版本来测试 VintaSoft Web 文档查看器的即用型本地化功能。有关 VintaSoft Web 文档查看器本地化的更多信息,请访问
此处。
VintaSoft ASP.NET 电子表格编辑器演示提供了现成的本地化词典,可以将
VintaSoft 网络电子表格文档编辑器 本地化为 32 种语言(南非荷兰语、阿拉伯语、白俄罗斯语、保加利亚语、中文、克罗地亚语、捷克语、丹麦语、荷兰语、英语、芬兰语、法语、德语、希腊语、希伯来语、印地语、匈牙利语、意大利语、日语、韩语、挪威语、葡萄牙语、罗马尼亚语、俄语、斯洛伐克语、斯洛文尼亚语、西班牙语、斯瓦希里语、瑞典语、土耳其语、越南语、祖鲁语)。您可以使用
VintaSoft ASP.NET Core 电子表格编辑器演示的在线版本。有关 VintaSoft Web 电子表格文档编辑器本地化的更多信息,请访问
此处。
VintaSoft ASP.NET Core 文档查看器演示和 VintaSoft ASP.NET 电子表格编辑器演示中现成的本地化字典可用于任何 ASP.NET 演示项目,即本地化字典可用于 ASP.NET Core、ASP.NET Core + Angular、ASP.NET MVC5 和 ASP.NET WebForms。这是因为 VintaSoft ASP.NET 演示在所有 ASP.NET 平台上都使用相同的 JavaScript 代码。
如果要本地化 VintaSoft Web 服务返回的字符串常量,则应按照"本地化 VintaSoft .NET 程序集"部分中的说明本地化 VintaSoft .NET 程序集。