Localize VintaSoft .NET assembly
In This Topic
All VintaSoft .NET assemblies have English language localization.
Also VintaSoft Imaging .NET SDK provides the ability to localize the following VintaSoft .NET assemblies (using satellite resource assemblies) into any language:
- 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
If you want to localize a Vintasoft .NET assembly, which is not present in the list above, please let us know and we will provide you the ability to localize the necessary Vintasoft .NET assembly.
Installer of VintaSoft Imaging .NET SDK delivers satellite assemblies in German language. The satellite assemblies in German language can be found in "{SdkInstallPath}\Imaging .NET 14.0\Bin\DotNetX\AnyCPU\de\" folder.
If you want to localize a VintaSoft .NET assembly from the list above, for example Vintasoft.Imaging.Pdf.dll, you need to do the following steps:
-
Extract the "Vintasoft.Imaging.Pdf.Localization.Strings.resources" resource file with constant strings from Vintasoft.Imaging.Pdf.dll.
Here is C# code of console application that allows to extract the "Vintasoft.Imaging.Pdf.Localization.Strings.resources" resource file from Vintasoft.Imaging.Pdf.dll assembly:
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);
}
}
}
Namespace ConsoleApp1
Friend Class Program
Friend Shared Sub Main(args As String())
Dim dotNetAssemblyFileName As String = "D:\VintaSoft\Imaging .NET v12.2\Bin\DotNet7\AnyCPU\Vintasoft.Imaging.Pdf.dll"
Dim resourceFileName As String = "Vintasoft.Imaging.Pdf.Localization.Strings.resources"
ExtractBinaryResourceFromDotNetAssembly(dotNetAssemblyFileName, resourceFileName)
End Sub
Private Shared Sub ExtractBinaryResourceFromDotNetAssembly(dotNetAssemblyFileName As String, resourceFileName As String)
Dim assembly As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile(dotNetAssemblyFileName)
Dim resourceStream As System.IO.Stream = assembly.GetManifestResourceStream(resourceFileName)
Dim resourceStreamBytes As Byte() = New Byte(resourceStream.Length - 1) {}
resourceStream.Read(resourceStreamBytes, 0, resourceStreamBytes.Length)
System.IO.File.WriteAllBytes(resourceFileName, resourceStreamBytes)
End Sub
End Class
End Namespace
-
Convert the "Vintasoft.Imaging.Pdf.Localization.Strings.resources" resource file into .resx file. This can be done using the ResGen utility.
Here is the command line that allows to convert .resources-file into .resx file:
"{Path_to_ResGen.exe_file}\ResGen.exe" Vintasoft.Imaging.Pdf.Localization.Strings.resources Strings.resx
-
Create Strings.resx file with constant strings, which are translated into the necessary language, for example in Spanish language:
- Rename the String.resx file to the Strings.es.resx file.
- Open the Strings.es.resx file in any text editor and translate string constants (strings in "value" tags) from English language to Spanish language.
-
Create the satellite assembly that contains translated constant strings:
- Create the "Vintasoft.Imaging.Pdf.es.resources" folder and go to the folder.
-
Create "Vintasoft.Imaging.Pdf.csproj" file using any text editor and add the following text into the created file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
- Create the "Localization" folder and go to the folder.
- Copy the Strings.es.resx file to the "Localization" folder.
- Go to the "Vintasoft.Imaging.Pdf.es.resources" folder
-
Compile the project using the following command:
dotnet build Vintasoft.Imaging.Pdf.csproj
- The satellite assembly "Vintasoft.Imaging.Pdf.resources.dll" will be created in the "bin\Debug\net8.0\es\" folder.
-
Use the satellite assembly with Vintasoft.Imaging.Pdf.dll:
- Create "es" folder in the folder where Vintasoft.Imaging.Pdf.dll assembly is located.
- Copy the created satellite assembly "Vintasoft.Imaging.Pdf.resources.dll" to the "es" folder.
- Run the application, which uses Vintasoft.Imaging.Pdf.dll assembly, and you will see Spanish text if your computer uses Spanish locale.
-
Also you can set the locale of .NET application to the Spanish locale if you want to see Spanish text on computer that uses non Spanish locale.
Here is C# code that shows how to set Spanish locale for .NET application:
System.Globalization.CultureInfo.CurrentCulture = new System.Globalization.CultureInfo("es");
System.Globalization.CultureInfo.CurrentUICulture = new System.Globalization.CultureInfo("es");
System.Globalization.CultureInfo.CurrentCulture = New System.Globalization.CultureInfo("es")
System.Globalization.CultureInfo.CurrentUICulture = New System.Globalization.CultureInfo("es")