How to use "data-i18n=" for title in "ion-view"?


#1

Take label for example

  <label class="item item-input">
    <span class="input-label" data-i18n="_UserName_"></span>
    <input type="text" ng-model="user.username">
  </label>

I can define UserName in resources-local_en-US file in www\i18n folder.

{
    "key":"_UserName_",
    "value":"UserNameen-US",
    "description":"User Name"
},

Who can help for how to use data-i18n= in “ion-view”? Thanks!


#2

For translation im using https://github.com/angular-translate/angular-translate

with this you can simply do this:
Tabs:

<ion-tabs class="tabs-icon-top">
    <ion-tab title="{{ 'Ui.setting' | translate }}" icon="ion-ios7-gear-outline" ui-sref="main.tabs.setting">
        <ion-nav-view name="setting-tab"></ion-nav-view>
    </ion-tab>
</ion-tabs>

On View:

<ion-view title="{{ 'Setting.title' | translate}}">
    <ion-content has-header="true" scroll="false" >
        <div class="list smaller-padding">
            <a class="item " ng-href="#/setting/about">
                {{ 'Setting.about' | translate }} 
            </a>
            <a class="item " ng-click="share()">
                {{ 'Setting.share' | translate }}  
            </a>
            <a class="item " ng-click="contactMe()">
                {{ 'Setting.contact' | translate }} 
            </a>
            <a class="item " ng-href="#/setting/faq">
                {{ 'Setting.faq' | translate }}
            </a>
            <a class="item " ng-click="openPremiumModal()">
                {{ 'Setting.upgrade' | translate }}
            </a>
        </div>
    </ion-content>
</ion-view>

and in a Controller you could do this:

text = $filter('translate')('Setting.language');

dont forget to include $translate into the controller.

i hope this helps