Copied to clipboard

Flag this post as spam?

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


  • Jan Skovgaard 11241 posts 23387 karma points MVP 6x admin c-trib
    Oct 14, 2015 @ 19:38
    Jan Skovgaard
    1

    Localization service in Umbraco 7.3.0 - Possible to have translations from areas returned?

    Hi guys

    I'm really happy to see the Localization service has finally arrived in Umbraco 7.3.0 - Awesome stuff :)

    Now...I'm just wondering if it's me...or do I not have an option to fetch localization keys pr. area rather than having to call the localization service several times to have specific items returned?

    According to the documentation at https://our.umbraco.org/documentation/Extending/Language-Files/Language-Files-For-Packages/ It's possible to fetch single keys by writing

    localizationService.localize("dialog_myKey").then(function(value){
                    element.html(value);
    });
    

    But I would like to be able to make one single call where I pass the name of the area and then get an object with the keys from that area returned. So calling

    localizationService.localize("dialog").then(function(value){
                    element.html(value);
    });
    

    Would return an object with all keys in the ara - Another method for doing this is probably needed since making calls for single items of course is useful.

    Am I missing something? If not I should probably make a feature request for this - Just want to check that it's not just me missing something :)

    Cheers, Jan

  • Joseph D'Souza 1 post 71 karma points
    Mar 21, 2019 @ 14:52
    Joseph D'Souza
    0

    I'm just browsing through Umbraco 8's source at the moment and in order to retrieve multiple keys, you can do something like this;

     var labels = ["sections_users", "general_groups", "user_userManagement"];
    
     localizationService.localizeMany(labels).then(function (data) {
          vm.page.labels.users = data[0];
          vm.page.labels.groups = data[1];
    

    I've taken this from the User Management section (as you may be able to tell). I have no idea is this would work for U7 I'm afraid.

Please Sign in or register to post replies

Write your reply to:

Draft