Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • André Lange 108 posts 410 karma points
    Apr 15, 2020 @ 07:31
    André Lange
    0

    Umbraco 8 Dashboard Language files, programmatically

    I have created a test dashboard, just to try it out, it appears but the language files does not seem to work, since the tab just says [alias-name]

    I'm creating the dashboard programmatically with a cs file, and adding the language files etc. on the side. But it does not appear to work.

    My CS file:

    [Weight(-10)]
        public class TestDashboard : IDashboard
        {
            public string[] Sections => new[] { "content" };
    
            public IAccessRule[] AccessRules => Array.Empty<IAccessRule>();
    
            public string Alias => "TestCustomDashboard";
    
            public string View => "/Business/Dashboards/Test/View/test.html";
        }
    

    Lang File Danish

    <?xml version ="1.0" encoding="utf-8" standalone="yes"?>
    <language alias="da" intName="Danish" localName="Dasnk" lcid="6" culture="da-DK">
      <area alias="sections">
        <key alias="TestCustomDashboard">Test mit specielle dashboard</key>
      </area>
    </language>
    

    Lang File English

    <?xml version ="1.0" encoding="utf-8" standalone="yes"?>
    <language alias="en" intName="English (US)" localName="English (US)" lcid="" culture="en-US">
      <area alias="sections">
        <key alias="TestCustomDashboard">Test Custom Dashboard</key>
      </area>
    </language>
    

    My View

    <umb-box>
        <umb-box-content>
            <h3>Test Dashboard</h3>
            <p>Dette er en test for at se om jeg kan lave et dashboard.</p>
        </umb-box-content>
    </umb-box>
    

    The file structure:

    enter image description here

    I have read the documentation and viewed a briding course video on Umbraco.tv but have been unable to find the answers.

    https://our.umbraco.com/documentation/Extending/Dashboards/#registering-with-c-type

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 15, 2020 @ 10:33
    Alex Skrypnyk
    0

    Hi,

    To localize a string use "localize" tag, like this:

    <p><localize key="TestCustomDashboard">Default value</localize></p>
    

    Thanks,

    Alex

  • André Lange 108 posts 410 karma points
    Apr 15, 2020 @ 10:37
    André Lange
    0

    In the bridging course video on Umbraco.tv it said i had to have lang files for the name on the tab.

    enter image description here

    Right now it just shows the alias.

  • Tim Miller 32 posts 252 karma points
    Apr 15, 2020 @ 19:19
    Tim Miller
    100

    Your language file is trying to set the alias for a section instead of a dashboard.

    Try this instead:

    <area alias="dashboardTabs">
         <key alias="TestCustomDashboard">Test Custom Dashboard</key>
    </area>
    

    See: https://our.umbraco.com/documentation/Extending/Dashboards/

  • André Lange 108 posts 410 karma points
    Apr 16, 2020 @ 06:12
    André Lange
    0

    That worked perfectly ^^ Thank you :D

Please Sign in or register to post replies

Write your reply to:

Draft