本文整理汇总了TypeScript中@lingui/react.i18nMark函数的典型用法代码示例。如果您正苦于以下问题:TypeScript i18nMark函数的具体用法?TypeScript i18nMark怎么用?TypeScript i18nMark使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了i18nMark函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: i18nMark
args.forEach((arg, index) => {
if (arg === "" || arg == undefined) {
errors.push({
path: ["job", "run", "args", `${index}`],
message: i18nMark("Arg cannot be empty.")
});
}
});
示例2: validateFormLabels
export function validateFormLabels(jobSpec: JobSpec): FormError[] {
const labels = (jobSpec.job.labels || []).map(([k]) => k);
const message = i18nMark("Cannot have multiple labels with the same key.");
return pipe(
allUniq(_ => "job.labels", [labels], message),
isUniqIn(labels)(i => `job.labels.${i}`, labels, message)
)([]);
}
示例3: formatServicePlanStatus
export function formatServicePlanStatus(status: ServicePlanStatus): string {
switch (status) {
case "ERROR":
return i18nMark("Error");
case "WAITING":
return i18nMark("Waiting");
case "PENDING":
return i18nMark("Pending");
case "PREPARED":
return i18nMark("Prepared");
case "STARTING":
return i18nMark("Starting");
case "STARTED":
return i18nMark("Started");
case "COMPLETE":
return i18nMark("Complete");
case "IN_PROGRESS":
return i18nMark("In Progress");
}
}
示例4: toCategoryLabel
function toCategoryLabel(category: StatusCategory): string {
switch (category) {
case StatusCategory.NA:
return i18nMark("N/A");
case StatusCategory.STOPPED:
return i18nMark("Stopped");
case StatusCategory.RUNNING:
return i18nMark("Running");
case StatusCategory.LOADING:
return i18nMark("Processing");
case StatusCategory.WARNING:
return i18nMark("Warning");
case StatusCategory.ERROR:
return i18nMark("Error");
}
}
示例5: flatMap
isValid: (val: T) => boolean,
defaultMessage: string
) => (path: (i: number) => string, values: T[], message = defaultMessage) => (
errors: FormError[]
) =>
errors.concat(
flatMap(
(value, index) =>
isValid(value) ? [] : [{ message, path: path(index).split(".") }],
values
)
);
const isBoolean = validation<boolean | undefined>(
x => x === undefined || typeof x === "boolean",
i18nMark("Must be a boolean.")
);
const isNumber = validation<number | undefined>(
x => x === undefined || typeof x === "number",
i18nMark("Must be a number.")
);
const isObject = validation<object | undefined>(
x => x === undefined || isObjectUtil(x),
i18nMark("Must be an object.")
);
const isPresent = validation<any>(
x => x !== undefined && x !== "",
i18nMark("Must be present.")
);
const isString = validation<string | undefined>(
x => x === undefined || typeof x === "string",
示例6: i18nMark
ERROR = "ERROR"
}
interface Status {
displayName: string;
category: StatusCategory;
priority: number;
}
///////////////////////////////////////////////////////////////////////////////
// ERRORS //
///////////////////////////////////////////////////////////////////////////////
const CREATION_ERROR: Status = {
priority: 32,
displayName: i18nMark("Error Creating Service"),
category: StatusCategory.ERROR
};
const UNAVAILABLE = {
priority: 31,
displayName: i18nMark("Service Unavailable"),
category: StatusCategory.ERROR
};
const ERROR = {
priority: 30,
displayName: i18nMark("Error"),
category: StatusCategory.ERROR
};
///////////////////////////////////////////////////////////////////////////////
// WARNINGS //
示例7: i18nMark
import { i18nMark } from "@lingui/react";
interface ServiceActionLabelsInterface {
edit: string;
delete: string;
restart: string;
resume: string;
open: string;
scale: string;
scale_by: string;
stop: string;
}
const ServiceActionLabels: ServiceActionLabelsInterface = {
edit: i18nMark("Edit"),
delete: i18nMark("Delete"),
restart: i18nMark("Restart"),
resume: i18nMark("Resume"),
open: i18nMark("Open Service"),
scale: i18nMark("Scale"),
scale_by: i18nMark("Scale By"),
stop: i18nMark("Stop")
};
export default ServiceActionLabels;