-
I created Class Library (WinUl 3 in Desktop) and some UI components inside. I can easely use I tried this, but It trying to get string from my application instead of dll resources
So how to get translation string inside dll from code? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
First of all, desktop applications, are recommended to use MRT Core, not MRT. This means that you want to use Microsoft.Windows.ApplicationModel.Resources.ResourceLoader and related functionality. There are two text resources here. One is in the executable's resources itself where the other is in a component's resources. Since this application is unpackaged, I am looking at Meh.pri here, since the application's executable is Meh.exe.
Right, so how do you obtain this? Well, the dumped .pri above shows the full path to the resource. It is also based upon the path of the resource. In the earlier screenshots, do you notice how Strings.resw is in a Strings/[language] subdirectory of the project? That is going to form part of the path. On top of that, if it is the resources for a component then the component name will be added to the path.
The above code, while C++, works properly. It should also be easy to translate this to C#. |
Beta Was this translation helpful? Give feedback.
-
WindowsAppSDK-Samples contains necessary info. Check: ResourceManagement |
Beta Was this translation helpful? Give feedback.
WindowsAppSDK-Samples contains necessary info. Check: ResourceManagement