Base solution for your next web application
Open Closed

Variable in @L operator #1517


User avatar
0
vitaly created

Hi,

I would like to repeat same element in html like below. But @L doesn't work properly. The result on the screen is [__Day_0], [__Day_1], etc. I have translation for these words in xml. I guess miss something. How to write it properly?

<div ng-repeat="i in [0,1,2,3,4,5,6,7]" class="row">
                    <div class="col-sm-4">
                        <div class="md-checkbox-list">
                            <div class="md-checkbox">
                                <input id="{{'day_'+i}}" class="md-check" type="checkbox" name="{{'day_'+i}}">
                                <label for="{{'day_'+i}}">
                                    <span class="inc"></span>
                                    <span class="check"></span>
                                    <span class="box"></span>
                                    @L("{{'__Day_'+i}}")
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-8">
                        <input type="text" id="{{'range_'+i}}" value="" name="range" />
                    </div>
                </div>

2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can use javascript version of it, app.localize('_Day'+i).

    But to make it work, define a function in your controller like this,

    vm.localize = function(key){
        return app.localize(key);
    }
    

    in your view use it like this

    vm.localize('__Day_'+i)
    
  • User Avatar
    0
    vitaly created

    Thank you )