當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript i18n.i18n類代碼示例

本文整理匯總了TypeScript中@kbn/i18n.i18n的典型用法代碼示例。如果您正苦於以下問題:TypeScript i18n類的具體用法?TypeScript i18n怎麽用?TypeScript i18n使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了i18n類的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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。