translate 的用法
1.在html页面:文本的翻译
<h1 translate>hello world</h1>
<h1 translate = 'hello world '></h1>
<h1> 'hello world '|translate </h1> 2.
placeholder= {{var|translate}}
aria-label={{var|translate}}
tooltip = {{var|translate}}
ng-bind= {{var|translate}}
ng-bind= {{key|translate}} <p translate = 'key' translate-values= ' { index:' {{var}}'}'
--json
key:".....{{index}}" 3.$translate.use();
define(function (require) {
return function SavedObjectFactory(es, kbnIndex, Promise, Private, Notifier, safeConfirm, indexPatterns,$translate) {
var angular = require('angular'); //luochunxiang@eisoo.com
var message ;
var lang = $translate.use();
if(lang === 'zh-cn'){
message = '你确定你想要覆盖 '
}else if(lang === 'zh-tw'){
message = '你確定你想要覆蓋 '
}else{
message = 'Are you sure you want to overwrite '
}
$
4.$translate.instant(key) var a = $translate.instant("Are you sure you want to delete the selected");
var b = $translate.instant("Are you sure you want to delete the selected");
var aaa = `trgutyr ${a}${currentTab.title}${b}`;
'rtguiyi'
var bbb = aaa; ---.js
var option = {
"Seconds": $translate.instant("Seconds ago"),
"Minutes":$translate.instant("Minutes ago"),
"Hours": $translate.instant("Hours ago"),
"Days": $translate.instant("Days ago"),
"Weeks": $translate.instant("Weeks ago"),
"Months": $translate.instant("Months ago"),
"Years": $translate.instant("Years ago")
};
$scope.relativeOptions = [
{text: option.Seconds, value: 's'},
{text: option.Hours, value: 'm'},
{text: option.Days, value: 'h'},
{text: option.Days, value: 'd'},
{text: option.Weeks, value: 'w'},
{text: option.Months, value: 'M'},
{text: option.Years, value: 'y'},
]; ---.html
<div class="form-group">
<select
ng-model="relative.unit"
ng-options="opt.value as opt.text for opt in relativeOptions"
translate-values
ng-change="formatRelative()"
class="form-control col-xs-2">
</select>
</div> 5直接使用window.localStorage.lang;
//luochunxiang@eisoo.com
var message ;
var lang = window.localStorage.lang;
if(lang === 'en-us'){
message = 'MMMM Do YYYY, HH:mm:ss.SSS'
}else if(lang === 'zh-tw'){
message = 'YYYY年MM月DD日, HH:mm:ss.SSS'
}else{
message = 'YYYY年MM月DD日, HH:mm:ss.SSS'
} 6 ng-show = "lang === 'en-us'"
<div ng-show = "lang === 'en-us'">
<saved-object-finder
title="Saved Searches"
type="searches"
make-url="step2WithSearchUrl">
</saved-object-finder>
</div>
<div ng-show = "lang === 'zh-tw'">
<saved-object-finder
title="已存搜索"
type="searches"
make-url="step2WithSearchUrl">
</saved-object-finder>
</div>
<div ng-show = "lang === 'zh-cn'">
<saved-object-finder
title="已存搜索"
type="searches"
make-url="step2WithSearchUrl">
</saved-object-finder>
</div> 7
<div ng-if="aggParam.name">
<span><label>{{ aggParam.name | translate }}</span> <span translate>Pattern</span></label>
</div>
<div ng-if="label">
<label>{{ label | translate }} <span translate>Pattern</span></label>
</div> <!-- <label>{{ aggParam.name | label }} <span translate>Pattern</span></label> -->

随机推荐

  1. firewall服务配置

    /* Border styles */ #table-2 thead, #table-2 tr { border-top-width: 1px; border-top-style: solid; bo ...

  2. class-支持向量机SVM全析笔记

    support vector machines,SVM是二类分类模型.定义在特征空间上间隔最大的线性分类器,由于包括核技巧实质上成为非线性分类器.学习策略是间隔最大化,可形式化为求解凸二次规划问题(c ...

  3. CSS3动画--过渡效果

    CSS3动画--过渡效果 transition                               设置四个过渡属性 transition-property          过渡的名称 tr ...

  4. 实现一个简单的订阅与发布模式的代码块,和redux

    /** * Created by Mrzou on 2018/3/11. */ //实现简单的订阅与发布模式的代码块export function pattern() { let currentLis ...

  5. 一个2D平面游戏,的碰撞引擎实现

    @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); i ...

  6. 【BZOJ1018】堵塞的交通(线段树)

    [BZOJ1018]堵塞的交通(线段树) 题面 Description 有一天,由于某种穿越现象作用,你来到了传说中的小人国.小人国的布局非常奇特,整个国家的交通系统可 以被看成是一个2行C列的矩形网 ...

  7. 【NOIP2012】开车旅行(倍增)

    题面 Description 小A 和小B决定利用假期外出旅行,他们将想去的城市从1到N 编号,且编号较小的城市在编号较大的城市的西边,已知各个城市的海拔高度互不相同,记城市 i的海拔高度为Hi,城市 ...

  8. 备库搭建后,进入备库报错psql: FATAL: the database system is starting up

        备库搭建后,进入备库报错psql: FATAL:  the database system is starting up  原因:备库配置文件没有hot_standby = on   mast ...

  9. 关于在Django中Json无法序列化datetime的解决办法

    我们在网页设计时经常会在前端和后台进行交互,前端回传的方法可以时redirect一个地址加上显式的参数,第二个办法就是使用Ajax结构.那么在传到view函数中进行处理后是需要通过Json格式进行返回 ...

  10. Apache中限制和允许特定IP访问

    Apache中限制和允许特定IP访问<Directory "/var/www">Options AllAllowOverride NoneOrder Deny,Allo ...