当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript react.i18nMark函数代码示例

本文整理汇总了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.")
     });
   }
 });
开发者ID:dcos,项目名称:dcos-ui,代码行数:8,代码来源:MetronomeJobValidators.ts

示例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)
  )([]);
}
开发者ID:dcos,项目名称:dcos-ui,代码行数:9,代码来源:MetronomeJobValidators.ts

示例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");
  }
}
开发者ID:dcos,项目名称:dcos-ui,代码行数:20,代码来源:ServicePlanStatus.ts

示例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");
  }
}
开发者ID:dcos,项目名称:dcos-ui,代码行数:16,代码来源:ServiceStatus.ts

示例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",
开发者ID:dcos,项目名称:dcos-ui,代码行数:31,代码来源:MetronomeJobValidators.ts

示例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                                  //
开发者ID:dcos,项目名称:dcos-ui,代码行数:31,代码来源:ServiceStatus.ts

示例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;
开发者ID:dcos,项目名称:dcos-ui,代码行数:25,代码来源:ServiceActionLabels.ts


注:本文中的@lingui/react.i18nMark函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。