Copied to clipboard

Flag this post as spam?

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

  • Sören Deger 726 posts 2833 karma points c-trib
    Jan 03, 2015 @ 16:12
    Sören Deger

    Localize in option tag doesn't work


    the first localize tag for key "mail2cms_protocol" in label works fine. But the next two localize tags in the option tags doesn't work. I get only the default values "IMAP" and "POP3", but I should see the values from en.xml.

    <div class="umb-property">
                                    <div class="control-group umb-control-group">
                                        <div class="umb-el-wrap">
                                            <label class="control-label" for="">
                                                <localize key="mail2cms_protocol">Protocol</localize>
                                                <small><localize key="mail2cms_protocolDescription"></localize></small>
                                            <div class="controls controls-row">   
                                                <select ng-model="mailbox.protocol" required>
                                                    <option value="imap"> <localize key="mail2cms_imap">IMAP</localize> </option>
                                                    <option value="pop3"> <localize key="mail2cms_pop3">POP3</localize> </option>

    Has anyone an idea or the same problem?

    Umbraco Version 7.1.7.



  • Sören Deger 726 posts 2833 karma points c-trib
    Jan 03, 2015 @ 16:43
    Sören Deger

    I have found, that it's not allowed to use any tags within an option tag. Another way is to use the label attribute of option tag.

    But how I can localize the value of an attribute from an html tag? Is there a way to do this?




  • Marcel van Helmont 68 posts 258 karma points c-trib
    Jan 05, 2015 @ 21:50
    Marcel van Helmont


    I think you must write your only angular directive to set the text of a option something like this.

        <option localize-option="temp"></option>
    angular.module("umbraco.directives").directive('localizeOption', function(localizationService) {
          return {
            restrict: 'A',
            link: function($scope, element, attrs, controller) {
                var key = attrs.localizeOption;
  • Sören Deger 726 posts 2833 karma points c-trib
    Jan 06, 2015 @ 06:14
    Sören Deger

    Hi Marcel,

    great :-) This works! Thank you!

  • Bjarne Fyrstenborg 1179 posts 3435 karma points MVP 4x c-trib
    Feb 28, 2015 @ 17:07
    Bjarne Fyrstenborg

    @Marcel first I tried with your approach, which work great. But there is already a built-in directive in the core that you can use.

    There is a directive for <umb-control-group> here

    and then utility element and attribute directive here:

    if <umb-control-group> element you can localize in like this:

    <umb-control-group ng-hide="hasAuthd()" label="@analytics_authorisation" description="@analytics_loginWithGoogleViaOAuth">
    <button class="btn btn-success" ng-click="auth()"><span class="icon-lock"></span>
    <localize key="analytics_authorize">Authorize</localize></button>

    For a <select> element with options the <localize> element directive doesn't work inside it, so you can use localize attribute directive:

    e.g. like this:

    <option value="" localize="label" label="@analytics_selectAnAccount"></option>

    or it could be the placeholder attribute on a textbox you want to localize:

    <input type="text" localize="placeholder" placeholder="@area_key"> 


  • Jan Wytze Zuidema 1 post 71 karma points
    Apr 23, 2018 @ 08:30
    Jan Wytze Zuidema

    Using label in an option tag doesn't seem to work in Firefox :(

Please Sign in or register to post replies

Write your reply to: