DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

DNN Platform Site localization

Sort:
You are not authorized to post a reply.
Page 2 of 4 << < 1234 > >>





New Around Here





    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]&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;root&gt; &lt;data name="Welcome.Text"&gt; &lt;value&gt;Accueil, value&gt; &lt;data&gt; &lt;root&gt;


    In the Home-Standard.axcx file, I am trying to add this snippet:

     &lt;dnn:TEXT runat="server" id="dnnTEXT-Welcome" Text="Welcome, " 
    CssClass="NormalBold" ResourceKey="Welcome.Text" ReplaceTokens="False" /&gt;


    How do I make this work? I am facing issues in using/rendering localized content based on resources.

    Please advice.





    Veteran Member





      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]&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;root&gt; &lt;data name="Welcome.Text"&gt; &lt;value&gt;Accueil, value&gt; &lt;data&gt; &lt;root&gt;


      In the Home-Standard.axcx file, I am trying to add this snippet:

       &lt;dnn:TEXT runat="server" id="dnnTEXT-Welcome" Text="Welcome, " CssClass="NormalBold" ResourceKey="Welcome.Text" ReplaceTokens="False" /&gt;


      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()) %>

       

       

      David Poindexter


      Creator:







      Advanced Member





        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.





        Veteran Member





          Oh that's really cool. After all these years, I still learn something new nearly every day! Thanks for sharing that Daniel!

          David Poindexter


          Creator:







          Senior Member





            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. 

             






            Advanced Member





              Also that value can contain tokens, so you could do stuff that is both localized and customize, like:

              Welcome, [User:FirstName]

              Most tokens here will work https://docs.dnncommunity...nt-tokens/index.html





              Veteran Member





                Cool intel right there!

                David Poindexter


                Creator:







                Senior Member





                  And this is a great example of why I sponsor both of you on GitHub!  💪🏽 






                  Veteran Member





                    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! 💙🎉

                     

                    David Poindexter


                    Creator:







                    New Around Here





                      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\

                        <data name="Welcome.Text" xml:space="preserve">
                          <value>Welcome>
                        <data>

                      --------------------------------------------------------------------------  

                      <data name="Welcome.Text" xml:space="preserve">
                          <value>Accueil>
                        <data>

                       

                       

                      You are not authorized to post a reply.
                      Page 2 of 4 << < 1234 > >>

                      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:

                      1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
                      2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
                      3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
                      4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
                      5. No Flaming or Trolling.
                      6. No Profanity, Racism, or Prejudice.
                      7. Site Moderators have the final word on approving / removing a thread or post or comment.
                      8. English language posting only, please.

                      Would you like to help us?

                      Awesome! Simply post in the forums using the link below and we'll get you started.

                      Get Involved