$translate 的用法
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> -->
随机推荐
- 使用图片作为a标签的点击按钮时,当触发touchstart的时候,往往会有一个灰色的背景,想要去掉的话可以用下面这种方式
a,a:hover,a:active,a:visited,a:link,a:focus{ -webkit-tap-highlight-color:rgba(0,0,0,0); -webki ...
- Educational Codeforces Round37 E - Connected Components?
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> ...
- Acperience HDU - 5734
Deep neural networks (DNN) have shown significant improvements in several application domains includ ...
- java实现全排列问题
1.问题描述: 一组字符串的全排列,按照全排列的顺序输出,并且每行结尾无空格. 2.输入: 输入一个字符串 3.输入示例: 请输入全排列的字符串: abc 4.输出示例: a b c a c b b ...
- HttpServletRequest对象
一.HttpServletRequest介绍 HttpServletRequest对象代表客户端的请求,当客户端通过HTTP协议访问服务器时,HTTP请求头中的所有信息都封装在这个对象中,通过这个对象 ...
- HttpServletResponse,HttpServletRequest详解
1.相关的接口 HttpServletRequest HttpServletRequest接口最常用的方法就是获得请求中的参数,这些参数一般是客户端表单中的数据.同时,HttpServletReq ...
- java io 节点流和处理流
JAVA IO操作总结:节点流和处理流 JAVA IO操作总结--节点流和处理流 按照流是否直接与特定的地方(如磁盘.内存.设备等)相连,分为节点流和处理流两类. 节点流:可以从或向一个特定的地方( ...
- iOS 双击tabbar刷新页面
/*在继承UITabBarController控制器中*/ #pragma mark <UITabBarControllerDelegate> -(void)tabBarControlle ...
- WPF自学入门(五)WPF依赖属性
在.NET中有事件也有属性,WPF中加入了路由事件,也加入了依赖属性.最近在写项目时还不知道WPF依赖属性是干什么用的,在使用依赖项属性的时候我都以为是在用.NET中的属性,但是确实上不是的,通过阅读 ...
- iOS9 HTTP 网络访问问题
今天升级Xcode 7.0 发现网络访问失败.输出错误信息 The resource could not be loaded because the App Transport Security po ...