Posted By Ram on 3/8/2024 12:10 PM Hello, I need some more information regarding skins and localization. I have the following skin file we use - Home-Standard.ascx (Portals\_default\Skins\SiteName) I have created the following 2 resource files (en-us and fr-fr) [code] Welcome, value> [/code] [code] Accueil, value> [/code] In the Home-Standard.axcx file, I am trying to add this snippet: [code] <dnn:TEXT runat="server" id="dnnTEXT-Welcome" Text="Welcome, " CssClass="NormalBold" ResourceKey="Welcome.Text" ReplaceTokens="False" />[/code] How do I make this work? I am facing issues in using/rendering localized content based on resources. Please advice.
In your User Control (Home-Standard.ascx) located at ~\Portals\_default\Skins\SkinName you will probably need something like the following:
protected string GetHomeStandardLocalResourceFilePath() { return PortalSettings.ActiveTab.SkinPath + Localization.LocalResourceDirectory; }
Make sure your Home-Standard.ascx.resx file is in ~\Portals\_default\Skins\SkinName\App_LocalResources.
Then wherever you need to access resource keys, you can use the following:
<%= Localization.GetString("Welcome", GetHomeStandardLocalResourceFilePath()) %>
Posted By Daniel Valadas on 3/8/2024 3:32 PM Oh, using the Text skinobject you don't need that code, you just need to have that key in a resource file for your skin. Assuming your skin is called "MySkin", you can copy any .resx file you find in any DesktopModules\***\App_LocalResources keep most of the xml but delete all the keys and add a key you need. Then rename that file MySkin.resx and place it in \Portals\_default\Skins\MySin\App_LocalResources folder. After that in DNN Servers, hit the clear cache button so DNN notices that change. FInaly you can go to your Portal Settings => Languages => Edit Icon (symbols) next to the language to translate In the resources file dropdown you will find this new file under Site Templates => Skins => MySkin => App_LocalResources => MySkin You can localize that for all your languages.
I'm filing this under "things I used to know but forgot years ago"... Wow! Nice suggestion, Daniel. I would've totally been doing what David suggested.
And this is a great example of why I sponsor both of you on GitHub! 💪🏽
Posted By Will Strohl on 3/9/2024 3:35 PM And this is a great example of why I sponsor both of you on GitHub! 💪🏽
Much appreciated Will! 💙🎉
Thanks a lot for the detailed explanation. I tried the following 2 ways in Home-Standard ASCX skin file. Cleared the cache and nothing is showing up in the front-end. What am I missing?
1) <%= Localization.GetString("Welcome", "C:\Sites\SITENAME\Portals\_default\Skins\SITENAME\App_LocalResources\Home-Standard") %> 2) <asp:Label ID="lblDisplayValue" runat="server" ResourceKey="Welcome.Text" />
Also, the following 2 resx files (Home-Standard.ascx and Home-Standard.fr-FR.ascx) are placed under - C:\Sites\SITENAME\Portals\_default\Skins\SITENAME\App_LocalResources\
Welcome>
--------------------------------------------------------------------------
Accueil>
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.