本文整理汇总了TypeScript中entcore.idiom.translate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript idiom.translate方法的具体用法?TypeScript idiom.translate怎么用?TypeScript idiom.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entcore.idiom
的用法示例。
在下文中一共展示了idiom.translate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
link:(scope:any) => {
scope.addAnswer = function(text_left = '', text_right = '') {
var newAnswer = {
text_left : text_left,
text_right : text_right
};
scope.grain.grain_data.custom_data.correct_answer_list.push(newAnswer);
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
if (!scope.grain.grain_data.custom_data) {
scope.grain.grain_data.custom_data = new AssociationCustomData();
scope.addAnswer(idiom.translate('exercizer.grain.asso.left.response'), idiom.translate('exercizer.grain.asso.right.response'));
}
scope.deleteAnswer = function(answer){
var index = scope.grain.grain_data.custom_data.correct_answer_list.indexOf(answer);
if(index !== -1){
scope.grain.grain_data.custom_data.correct_answer_list.splice(index, 1);
}
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
scope.updateGrain = function() {
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
}
示例2: function
link:(scope:any) => {
scope.addAnswer = function(text = ''){
var newOrder = (window as any).parseFloat(getLastOrder()) + 1;
var newAnswer = {
order_by : newOrder,
index : newOrder - 1,
text : text
};
scope.grain.grain_data.custom_data.correct_answer_list.push(newAnswer);
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
if (angular.isUndefined(scope.grain.grain_data.custom_data)) {
scope.grain.grain_data.custom_data = new OrderCustomData();
scope.addAnswer( idiom.translate('exercizer.grain.order.default1'));
scope.addAnswer( idiom.translate('exercizer.grain.order.default2'));
}
scope.deleteAnswer = function(answer){
var indexDeleted = answer.index;
var index = scope.grain.grain_data.custom_data.correct_answer_list.indexOf(answer);
if(index !== -1){
scope.grain.grain_data.custom_data.correct_answer_list.splice(index, 1);
}
angular.forEach(scope.grain.grain_data.custom_data.correct_answer_list, function(value){
if(value.index > indexDeleted){
value.index = parseFloat(value.index) - 1;
}
});
scope.reOrder();
};
function getLastOrder(){
var maxOrder = null;
angular.forEach(scope.grain.grain_data.custom_data.correct_answer_list, function(value){
if(maxOrder === null || value.order_by > maxOrder){
maxOrder = value.order_by;
}
});
if(maxOrder === null){
return 0;
}
return maxOrder;
}
scope.reOrder = function(){
angular.forEach(scope.grain.grain_data.custom_data.correct_answer_list, function(value){
if(value.order_by != parseFloat(value.index) + 1){
value.order_by = parseFloat(value.index) + 1;
}
});
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
scope.updateGrain = function() {
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
}
示例3: function
link:(scope:any) => {
scope.addAnswer = function(isChecked = false, text = '') {
var newAnswer = {
isChecked : isChecked,
text : text
};
scope.grain.grain_data.custom_data.correct_answer_list.push(newAnswer);
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
if (angular.isUndefined(scope.grain.grain_data.custom_data)) {
scope.grain.grain_data.custom_data = new QcmCustomData();
scope.addAnswer(true, idiom.translate('exercizer.grain.qcm.default1'));
scope.addAnswer(false, idiom.translate('exercizer.grain.qcm.default2'));
}
scope.deleteAnswer = function(answer){
var index = scope.grain.grain_data.custom_data.correct_answer_list.indexOf(answer);
if (index !== -1) {
scope.grain.grain_data.custom_data.correct_answer_list.splice(index, 1);
}
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
scope.updateGrain = function() {
scope.$emit('E_UPDATE_GRAIN', scope.grain);
};
}
示例4: function
$scope.showConversationHistory = function () {
if ($scope.isSlided) {
$scope.messageHistory = lang.translate('message.history.show');
}
else {
$scope.messageHistory = lang.translate('message.history.hide');
}
$scope.isSlided = !$scope.isSlided;
}
示例5: function
$scope.translateComplexity = function(password){
var score = $scope.passwordComplexity(password)
if(score < 12){
return lang.translate("weak")
}
if(score < 20)
return lang.translate("moderate")
return lang.translate("strong")
}
示例6: function
$scope.displayCode = function (user) {
if (user.blocked) {
return lang.translate("directory.blocked.label");
} else if (user.activationCode) {
return user.activationCode;
} else if (user.resetCode) {
return lang.translate("directory.resetted.label").replace("[[resetCode]]", user.resetCode).replace("[[resetCodeDate]]", user.resetCodeDate)
} else {
return lang.translate("directory.activated");
}
}
示例7: function
$scope.classnameForDuplicateUser = function (user) {
const classes: string[] = user.classNames;
if (classes.length === 0) {
return lang.translate("classAdmin.duplicate.label.none");
}
if (classes.length === 1) {
return lang.translate("classAdmin.duplicate.label.one").replace("[[className]]", classes[0]);
}
// There are at least two classes
return lang.translate("classAdmin.duplicate.label.several").replace("[[classNames]]", classes.join(", "));
}
示例8: function
scope.getTab = function(){
switch (scope.currentTab){
case 'mySubjects':
return idiom.translate("exercizer.dashboard.instructer.tab1");
case 'correction':
return idiom.translate("exercizer.dashboard.instructer.tab2");
case 'library':
return idiom.translate("exercizer.dashboard.instructer.tab3");
default :
throw "tab "+scope.currentTab+" missing"
}
};
示例9: function
$scope.userExportInfo = function () {
if ($scope.userExport.onlySelected) {
return (lang.translate("classAdmin.export.count") as string).replace("[[count]]", _selected.length + "");
} else {
let len = $scope.userExport.profiles.length;
let info: string = lang.translate(`classAdmin.export.create.profil${len}`);
let index = 0;
for (let profile of $scope.userExport.profiles) {
const key = `directory.${profile}s`.toLowerCase();
const value = (lang.translate(key) as string).toLowerCase();
info = info.replace(`[[profile${++index}]]`, value);
}
return info;
}
}
示例10: function
lang.addBundle('/directory/i18n', function(){
Birthday.emptyList = lang.translate('nobirthday');
Birthday.birthdays = _.filter(birthdays, function(birthday){
return moment(birthday.birthDate).month() === moment().month();
});
Birthday.birthdays = Birthday.birthdays.sort(function(a, b){
return moment(a.birthDate).date() - moment(b.birthDate).date()
});
var classes = [];
classes = _.pluck(Birthday.birthdays, 'classes');
classes.forEach(function(classList){
classList.forEach(function(myClass){
if(!_.findWhere(Birthday.classes, {id :myClass[0] })){
Birthday.classes.push({
name: myClass[1],
id: myClass[0]
});
}
});
});
Birthday.currentClass = _.findWhere(Birthday.classes, { id: Birthday.currentClass.id })
if(!Birthday.currentClass){
Birthday.currentClass = Birthday.classes[0];
}
model.widgets.apply();
});