Copied to clipboard

Flag this post as spam?

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


  • Chester Campbell 98 posts 209 karma points
    Jan 28, 2022 @ 22:18
    Chester Campbell
    0

    Extended lang files cause error - site not to load

    Per this documentation page: https://our.umbraco.com/documentation/Extending/Language-Files/ ... buried down the page under the title "User language files" ... it says we should be able to override the default language files by creating our own using the naming syntax: {language}.user.xml.

    And, indeed, this used to work quite well under Umbraco 8 and later releases of Umbraco 7.

    But when I do this with an Umbraco 9 site I get an error and the site will not run. In my case I created a new file named "en_us.user.xml" that contained the following:

    <?xml version="1.0" encoding="utf-8" ?>
    <language alias="en_us" intName="English (US)" localName="English (US)" lcid="" culture="en-US">
        <area alias="login">
            <key alias="greeting0">My Test CMS</key>
            <key alias="greeting1">My Test CMS</key>
            <key alias="greeting2">My Test CMS</key>
            <key alias="greeting3">My Test CMS</key>
            <key alias="greeting4">My Test CMS</key>
            <key alias="greeting5">My Test CMS</key>
            <key alias="greeting6">My Test CMS</key>
        </area>
    </language>
    

    When I try to load the site I get the following error:

    CultureNotFoundException: Culture is not supported. (Parameter 'name') en-us.user is an invalid culture identifier.
    

    Notice it thinks the culture is "en-us.user". Apparently, the filename is being parsed incorrectly.

    Anyone else run into this? Find a way around it? Maybe there's a different way to accomplish this than how the documentation describes?

  • Kevin Jump 2311 posts 14697 karma points MVP 7x c-trib
    Jan 28, 2022 @ 23:19
    Kevin Jump
    100

    Hi,

    I would just check that you have put your language file in /config/lang (which on Umbraco 9 you will need to create).

    looking at the Umbraco source if the file is in that folder then the .user will be stripped from the file name, so guessing its somewhere else ?

    also just tried your xml locally in the config/lang folder and it works.

  • Chester Campbell 98 posts 209 karma points
    Feb 01, 2022 @ 19:57
    Chester Campbell
    0

    You're absolutely correct! Creating the file as /config/lang/en_us.user.xml worked.

    Before I had it as /umbraco/config/lang/en_us.user.xml.

    This is my first Umbraco 9/Core project so since the directory structure has changed I wasn't sure putting /config/lang/ back in place was the correct thing to do.

Please Sign in or register to post replies

Write your reply to:

Draft