What is it?
.NET Library Localizer is a cloud API for processing compiled .NET libraries made with C# or VB.NET
What does it do?
It facilitates translation of .NET assemblies (DLLs) made with framework versions from 4.0 up to 4.6
This article is intended for developers who make .NET software using Visual Studio with nuget installed.
An Internet connection is required in order to connect to the API
The minimum framework version for using the API is 4.0
- Open Visual Studio and create a new Class Library project, name it TestLibrary.VB if you are using VB.NET or TestLibrary.CSharp for C#
- Delete Class1.vb or Class1.cs and create a new class, name it Test.vb or Test.cs
- Open project properties and then open the Assembly Information editor; specify the Neutral Language (for this walkthrough) as English (United States)
PM> Install-Package Newtonsoft.Json
- Add the helper class in your project:
- Open Test.vb or Test.cs and add a function that returns a string
The result so far...
First you need to compile your DLL project, then copy either TestLibrary.VB.dll or TestLibrary.CSharp.dll to a new folder in addition to Newtonsoft.Json.dll.
- Open Visual Studio and create a new Console Application project, name it NLL.Com.VB if you are using VB.NET or NLL.Com.CSharp if you are using C#
- Now, you need to add 3 references before you connect to the API:
- First, Download NLL.zip and add reference to NLL.dll file
PM> Install-Package Newtonsoft.Json
PM> Install-Package DotNetZip
- Open Module1.vb or Program.cs and edit Sub Main() or static void Main(string args); here is the code to insert...
For VB.NET (Download Project)
For CSharp (Download Project)
Run the application, and wait for the result.
The result would be two files saved in the application folder, the modified library "TestLibrary.VB.dll" or "TestLibrary.CSharp.dll" with another file named "TestLibrary.VB en-US" or "TestLibrary.CSharp en-US".
The second file contains simply JSON data representing the strings in the input DLL. Make two copies of this file in the same folder, name the first "TestLibrary.VB fr-FR" or "TestLibrary.CSharp fr-FR" and the second "TestLibrary.VB es-ES" or "TestLibrary.CSharp es-ES".
Now use any text editor (like Notepad) to open the two files you created so far. Look for "Hello World!" and change it to "Bonjour le monde !" inside the file named "TestLibrary.VB fr-FR" or "TestLibrary.CSharp fr-FR" and to "Hola Mundo!" in "TestLibrary.VB es-ES" or "TestLibrary.CSharp es-ES".
That's it! You have now a fully localizable DLL with translations.
Its not over yet, let's go to the test!
Download the GUI Tool.
Make sure to enter all the values properly for each project language
Example for VB.NET project (the root namespace is required if not left blank in the VB project, otherwise the server returns an error)
Options for CSharp project (The default namespace is different from root namespace in Visual Basic, leave it blank)
Now that we have the result DLL from the API, we shall test it.
1. Add a reference to TestLibrary.VB.dll or TestLibrary.CSharp.dll back from the server to a new Console Application project called ConsoleDemo.VB or ConsoleDemo.CSharp
2. Open Module1.vb or Program.cs, and update Sub Main() or static void Main(string args) with the the following code
3. Inside the project add the three translation files ("TestLibrary.VB en-US", "TestLibrary.VB fr-FR" and "TestLibrary.VB es-ES" or "TestLibrary.CSharp en-US", "TestLibrary.CSharp fr-FR" and "TestLibrary.CSharp es-ES") to the root of your project, select all three and switch to file properties, select Copy Always in Copy to Output Directory
4. Run the project and see it in action...
If you want to tell me about any bugs, make suggestions or critics, or simply comment, send me an email at firstname.lastname@example.org.
If you are really interested, and want an account with custom features on the server side contact me via Upwork https://www.upwork.com/freelancers/~015a6b6dbddab22502.
Thank you for reading.
Mohamed Amine SEBBANE