Search code examples
c#.netasp.net-mvc.net-6.0txtextcontrol

TXTextControl .NET - Localization and satellite assembly installation


Tx Text Control USER INTERFACE TRANSLATION

I am trying to understand how to build a satellite assembly but I am not really grasping the idea of how to begin.

So far, I have been running the project in my localhost and I was able to execute and get it running as a demo. I had to link the .dll files from my application's installation folder to my .NET 6 MVC project.

Here are some links that guide you through the creation of a satellite assembly for changing the language of the user interface to a language of your preference.

Using the Resource Kit

[https://docs.textcontrol.com/textcontrol/windows-forms/article.techarticle.resourcekit.htm][1]

Create satellite assemblies for .NET apps

https://learn.microsoft.com/en-us/dotnet/core/extensions/create-satellite-assemblies

EDIT

The version of the web application is .NET 6 and I am debugging the ASP.NET Core > tx-aspnet-core-editor sample. I had to register this key txtextcontrol.resources,6B83FE9A75CFB638 to my System Registry.

The path is this:
MyComputer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\txtextcontrol.resources,6B83FE9A75CFB638.

Firstly, I have tried doing some of the translations on the .resx files which are located here => C:\Program Files\Text Control GmbH\TX Text Control 32.0.NET Server for ASP.NET\ResourceKit

I executed the buildres.bat - running the command buildres es file which firstly generated the resource files and then the dll files: TXTextControl.resources.dll, TXTextControl.Web.Server.Process.resources.dll

After this, I have put the .dll files into a subdirectory of my software application located here: C:\Program Files\Text Control GmbH\TX Text Control 32.0.NET Server for ASP.NET\Assembly\es.

Finally I have tried debugging my .NET Core application by setting as a default language the Spanish language:

System.Globalization.CultureInfo.GetCultureInfo("es-ES");

The language still remains in English. Is there any suggestion on how to be able to translate this efficiently? Is there maybe a demo of another language besides German and English ?

I have tried the German .dll version and it works. Just for testing, I copied the german assembly files to the /es subdirectory so that I can see that the translation is working but it does not.

Can anyone give me a hint on what I need for making this possible ?

Thanks


Solution

  • So I found a solution after a week of doing a thorough research on the matter.

    I firstly generated the .dll files which contain all the translations. To achieve that I had to firstly go to C:\Program Files\Text Control GmbH\TX Text Control 32.0.NET Server for ASP.NET\ResourceKit

    and opened the buildres.bat file. I had to do some minor edits to that file which were these: For the spanish language you neet to specify the ISO code for spanish language which is buildres es just at the last line of the script.

    @if "%1"=="" goto error
    @echo generating resources files:
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\ResGen.exe" textcontrol.resx TXTextControl.TextControlCore.%1.resources
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\ResGen.exe" documentserver.resx TXTextControl.DocumentServer.Properties.Resources.%1.resources
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\ResGen.exe" TXTextControl.Web.Server.Process.resx TXTextControl.Web.Server.Process.Properties.Resources.%1.resources
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\ResGen.exe" txdrawing.resx TXTextControl.Drawing.TXDrawing.%1.resources
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\ResGen.exe" txbarcode.resx TXTextControl.Barcode.TXBarcodeCore.%1.resources
    @echo generating satellite assemblies:
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\al.exe" /out:txtextcontrol.resources.dll /v:32.0.2500.500 /keyf:txtextcontrol.public.snk /c:%1 /delay+ /embed:TXTextControl.TextControlCore.%1.resources
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\al.exe" /out:txdocumentserver.resources.dll /v:32.0.1800.500 /keyf:txtextcontrol.public.snk /c:%1 /delay+ /embed:TXTextControl.DocumentServer.Properties.Resources.%1.resources
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\al.exe" /out:txtextcontrol.web.server.process.resources.dll /v:32.0.1200.500 /keyf:txtextcontrol.public.snk /c:%1 /delay+ /embed:TXTextControl.Web.Server.Process.Properties.Resources.%1.resources
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\al.exe" /out:txdrawing.resources.dll /v:32.0.800.500 /keyf:txtextcontrol.public.snk /c:%1 /delay+ /embed:TXTextControl.Drawing.TXDrawing.%1.resources
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\al.exe" /out:txbarcode.resources.dll /v:32.0.800.500 /keyf:txtextcontrol.public.snk /c:%1 /delay+ /embed:TXTextControl.Barcode.TXBarcodeCore.%1.resources
    @echo turning off verification for the assemblies:
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -Vr txtextcontrol.resources.dll
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -Vr txdocumentserver.resources.dll
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -Vr txtextcontrol.web.server.process.resources.dll
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -Vr txdrawing.resources.dll
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -Vr txbarcode.resources.dll
    @echo.
    @echo satellite assemblies successfully generated.
    @goto end
    :error
    buildres es
    :end
    

    Next step was to open the terminal with system admin rights and headed inside the subdirectory where the buildres.bat is located.

    I executed the buildres.bat file on the terminal and then I got the .resources.dll files that are needed in order to import to my .NET Core app.

    I created a subdirectory called /es inside my web application and imported these lines into my .csproj file

    <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
        <RootNamespace>tx_aspnet_core_editor</RootNamespace>
    </PropertyGroup>
    
    <PropertyGroup>
        <GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>
    </PropertyGroup>
    <ItemGroup>
      <PackageReference Include="TXTextControl.Web" Version="32.1.0" />
    </ItemGroup>
    
    <ItemGroup>
      <Folder Include="es\" />
    </ItemGroup>
    <ItemGroup>
      <None Update="es\txbarcode.resources.dll">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </None>
      <None Update="es\txdocumentserver.resources.dll">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </None>
      <None Update="es\txdrawing.resources.dll">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </None>
      <None Update="es\txtextcontrol.resources.dll">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </None>
      <None Update="es\txtextcontrol.web.server.process.resources.dll">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </None>
    </ItemGroup>
    

    It has worked like a charm.