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


TypeScript i18n.translate方法代码示例

本文整理汇总了TypeScript中@kbn/i18n.i18n.translate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript i18n.translate方法的具体用法?TypeScript i18n.translate怎么用?TypeScript i18n.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@kbn/i18n.i18n的用法示例。


在下文中一共展示了i18n.translate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: validateURLIdentifier

  public validateURLIdentifier(space: Partial<Space>) {
    if (!this.shouldValidate) {
      return valid();
    }

    if (isReservedSpace(space)) {
      return valid();
    }

    if (!space.id) {
      return invalid(
        i18n.translate('xpack.spaces.management.validateSpace.urlIdentifierRequiredErrorMessage', {
          defaultMessage: 'URL identifier is required.',
        })
      );
    }

    if (!isValidSpaceIdentifier(space.id)) {
      return invalid(
        i18n.translate(
          'xpack.spaces.management.validateSpace.urlIdentifierAllowedCharactersErrorMessage',
          {
            defaultMessage:
              'URL identifier can only contain a-z, 0-9, and the characters "_" and "-".',
          }
        )
      );
    }

    return valid();
  }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例2: validateRoleName

  public validateRoleName(role: Role): RoleValidationResult {
    if (!this.shouldValidate) {
      return valid();
    }

    if (!role.name) {
      return invalid(
        i18n.translate(
          'xpack.security.management.editRole.validateRole.provideRoleNameWarningMessage',
          {
            defaultMessage: 'Please provide a role name',
          }
        )
      );
    }
    if (role.name.length > 1024) {
      return invalid(
        i18n.translate('xpack.security.management.editRole.validateRole.nameLengthWarningMessage', {
          defaultMessage: 'Name must not exceed 1024 characters',
        })
      );
    }
    if (!role.name.match(/^[a-zA-Z_][a-zA-Z0-9_@\-\$\.]*$/)) {
      return invalid(
        i18n.translate(
          'xpack.security.management.editRole.validateRole.nameAllowedCharactersWarningMessage',
          {
            defaultMessage:
              'Name must begin with a letter or underscore and contain only letters, underscores, and numbers.',
          }
        )
      );
    }
    return valid();
  }
开发者ID:elastic,项目名称:kibana,代码行数:35,代码来源:validate_role.ts

示例3: validateUsername

  public validateUsername(user: User): UserValidationResult {
    if (!this.shouldValidate) {
      return valid();
    }

    const { username } = user;
    if (!username) {
      return invalid(
        i18n.translate('xpack.security.management.users.editUser.requiredUsernameErrorMessage', {
          defaultMessage: 'Username is required',
        })
      );
    } else if (username && !username.match(validUsernameRegex)) {
      return invalid(
        i18n.translate(
          'xpack.security.management.users.editUser.usernameAllowedCharactersErrorMessage',
          {
            defaultMessage:
              'Username must begin with a letter or underscore and contain only letters, underscores, and numbers',
          }
        )
      );
    }

    return valid();
  }
开发者ID:elastic,项目名称:kibana,代码行数:26,代码来源:validate_user.ts

示例4: resolve

export const uptime = (kibana: any) =>
  new kibana.Plugin({
    configPrefix: 'xpack.uptime',
    id: PLUGIN.ID,
    require: ['kibana', 'elasticsearch', 'xpack_main'],
    publicDir: resolve(__dirname, 'public'),
    uiExports: {
      app: {
        description: i18n.translate('xpack.uptime.pluginDescription', {
          defaultMessage: 'Uptime monitoring',
          description: 'The description text that will be shown to users in Kibana',
        }),
        icon: 'plugins/uptime/icons/heartbeat_white.svg',
        euiIconType: 'uptimeApp',
        title: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', {
          defaultMessage: 'Uptime',
        }),
        main: 'plugins/uptime/app',
        order: 8900,
        url: '/app/uptime#/',
      },
      home: ['plugins/uptime/register_feature'],
    },
    init(server: Server) {
      initServerWithKibana(server);
    },
  });
开发者ID:njd5475,项目名称:kibana,代码行数:27,代码来源:index.ts

示例5: tpmUnit

export function tpmUnit(type?: string) {
  return type === 'request'
    ? i18n.translate('xpack.apm.formatters.requestsPerMinLabel', {
        defaultMessage: 'rpm'
      })
    : i18n.translate('xpack.apm.formatters.transactionsPerMinLabel', {
        defaultMessage: 'tpm'
      });
}
开发者ID:gingerwizard,项目名称:kibana,代码行数:9,代码来源:formatters.ts

示例6: _displayError

 public _displayError() {
   toastNotifications.addDanger({
     title: i18n.translate('xpack.spaces.spacesManager.unableToChangeSpaceWarningTitle', {
       defaultMessage: 'Unable to change your Space',
     }),
     text: i18n.translate('xpack.spaces.spacesManager.unableToChangeSpaceWarningDescription', {
       defaultMessage: 'please try again later',
     }),
   });
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例7: getResponseTimeSeries

export function getResponseTimeSeries(
  apmTimeseries: ApmTimeSeriesResponse,
  anomalyTimeseries?: AnomalyTimeSeriesResponse
) {
  const { overallAvgDuration } = apmTimeseries;
  const { avg, p95, p99 } = apmTimeseries.responseTimes;

  const series: TimeSerie[] = [
    {
      title: i18n.translate('xpack.apm.transactions.chart.averageLabel', {
        defaultMessage: 'Avg.'
      }),
      data: avg,
      legendValue: asMillis(overallAvgDuration),
      type: 'linemark',
      color: colors.apmBlue
    },
    {
      title: i18n.translate(
        'xpack.apm.transactions.chart.95thPercentileLabel',
        {
          defaultMessage: '95th percentile'
        }
      ),
      titleShort: '95th',
      data: p95,
      type: 'linemark',
      color: colors.apmYellow
    },
    {
      title: i18n.translate(
        'xpack.apm.transactions.chart.99thPercentileLabel',
        {
          defaultMessage: '99th percentile'
        }
      ),
      titleShort: '99th',
      data: p99,
      type: 'linemark',
      color: colors.apmOrange
    }
  ];

  if (anomalyTimeseries) {
    // insert after Avg. series
    series.splice(
      1,
      0,
      getAnomalyBoundariesSeries(anomalyTimeseries.anomalyBoundaries),
      getAnomalyScoreSeries(anomalyTimeseries.anomalyScore)
    );
  }

  return series;
}
开发者ID:liuyepiaoxiang,项目名称:kibana,代码行数:55,代码来源:chartSelectors.ts

示例8:

FeatureCatalogueRegistryProvider.register(() => ({
  id: 'uptime',
  title: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', { defaultMessage: 'Uptime' }),
  description: i18n.translate('xpack.uptime.featureCatalogueDescription', {
    defaultMessage: 'Perform endpoint health checks and uptime monitoring.',
  }),
  icon: 'heartbeatApp',
  path: `uptime#/`,
  showOnHomePage: true,
  category: FeatureCatalogueCategory.DATA,
}));
开发者ID:liuyepiaoxiang,项目名称:kibana,代码行数:11,代码来源:register_feature.ts

示例9: siem

export function siem(kibana: any) {
  return new kibana.Plugin({
    id: APP_ID,
    configPrefix: 'xpack.siem',
    publicDir: resolve(__dirname, 'public'),
    require: ['kibana', 'elasticsearch'],
    uiExports: {
      app: {
        description: i18n.translate('xpack.siem.securityDescription', {
          defaultMessage: 'Explore your SIEM App',
        }),
        main: 'plugins/siem/app',
        euiIconType: 'securityAnalyticsApp',
        title: APP_NAME,
        listed: false,
        url: `/app/${APP_ID}`,
      },
      home: ['plugins/siem/register_feature'],
      links: [
        {
          description: i18n.translate('xpack.siem.linkSecurityDescription', {
            defaultMessage: 'Explore your SIEM App',
          }),
          euiIconType: 'securityAnalyticsApp',
          id: 'siem',
          order: 9000,
          title: APP_NAME,
          url: `/app/${APP_ID}`,
        },
      ],
      uiSettingDefaults: {
        [DEFAULT_INDEX_KEY]: {
          name: i18n.translate('xpack.siem.uiSettings.defaultIndexLabel', {
            defaultMessage: 'Default index',
          }),
          value: ['auditbeat-*', 'filebeat-*', 'packetbeat-*', 'winlogbeat-*'],
          description: i18n.translate('xpack.siem.uiSettings.defaultIndexDescription', {
            defaultMessage: 'Default Elasticsearch index to search',
          }),
          category: ['siem'],
          requiresPageReload: true,
        },
      },
      mappings: savedObjectMappings,
    },
    init(server: Server) {
      initServerWithKibana(server);
    },
  });
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例10: compose

export const initServerWithKibana = (server: KibanaServer) => {
  const libs = compose(server);
  initUptimeServer(libs);

  const xpackMainPlugin = server.plugins.xpack_main;
  xpackMainPlugin.registerFeature({
    id: PLUGIN.ID,
    name: i18n.translate('xpack.uptime.featureRegistry.uptimeFeatureName', {
      defaultMessage: 'Uptime',
    }),
    navLinkId: PLUGIN.ID,
    icon: 'uptimeApp',
    app: ['uptime', 'kibana'],
    catalogue: ['uptime'],
    privileges: {
      all: {
        api: ['uptime'],
        savedObject: {
          all: [],
          read: [],
        },
        ui: ['save'],
      },
      read: {
        api: ['uptime'],
        savedObject: {
          all: [],
          read: [],
        },
        ui: [],
      },
    },
  });
};
开发者ID:,项目名称:,代码行数:34,代码来源:


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