Copied to clipboard

Flag this post as spam?

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


  • Max 80 posts 437 karma points
    Jul 13, 2018 @ 18:44
    Max
    0

    localizationService.localize not referencing app_plugin language file

    I have a custom section and custom edit forms: does localizationService.localize("[area_key]") call my language file in ~/App_Plugins/[app_name]/lang/en-GB.xml

    <?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="RoutesSection">Routes &amp; Schedules</key>
      </area>
      <area alias="routessection">
        <key alias="statuscanceled">Cut&#47;Canceled</key>
      </area>
    </language>
    

    When i make the call from my angularjs controller:

    var mylabel = localizationService.localize("routessection_statuscanceled");
    

    my angularjs view outputs: [routessection_statuscanceled] instead of "Cut/Canceled"

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Jul 13, 2018 @ 19:23
    Søren Gregersen
    0

    Hi Max,

    Could it be as simple as the file being named en-GB.xml, and not en-US.xml?

  • Max 80 posts 437 karma points
    Jul 13, 2018 @ 19:28
    Max
    100

    Thank you for the response. I literally just figured out the issue... it was as simple as refreshing my web.config. I needed to restart the app in order to re-cache/reload my lang files.

    In response to your suggestion: I had considered that. However, at the moment, I have my en-US and en-GB lang files identical...(as a result of that idea) but my backend admin culture is still set to en-GB. And as I understand it, that is the default for an Umbraco backend install.

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Jul 13, 2018 @ 21:46
    Søren Gregersen
    0

    https://our.umbraco.com/documentation/Extending/Section-Trees/sections

    Create a /lang folder in the folder where you are creating the implementation for your custom section(if not create one in the appplugins folder eg /appplugins/favouritethings/lang)

    inside this folder create a file called en-us.xml this is the 'default' fallback language translation file, and add the following definition:

    I think it will use the one that mactches the culture the user you are logged in with have setup :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies