How to use the @lingui/core.i18nMark function in @lingui/core

To help you get started, we’ve selected a few @lingui/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / lingui__core / lingui__core-tests.ts View on Github external
function missingFn(language: string, id: string) {
   return id;
}

const catalogs: Catalogs = { es: catalog };
const setupResult: I18n = setupI18n({ catalogs, language: 'es' });
const setupResultLocales: I18n = setupI18n({ locales: ['en-UK', 'ar-AS'] });
const setupResultMissingText: I18n = setupI18n({ missing: 'missing' });
const setupResultMissingFn: I18n = setupI18n({ missing: missingFn });
const setupResultCombined: I18n = setupI18n({ catalogs, language: 'de', locales: ['en-UK', 'ar-AS'], missing: missingFn });

const formattedDate: string = date('en', { timeZone: 'UTC' })(new Date());
const formattedNumber: string = number('en', { style: 'currency', currency: 'EUR' })(1234.56);

const mark: string = i18nMark('mark');
github dcos / dcos-ui / plugins / ui-update / notifications.ts View on Github external
map(uiMetadata => {
          const displayVersion = semver.coerce(uiMetadata.serverBuild);
          const title = this._i18n._(i18nMark("New UI Available"));
          const description = this._i18n._(
            i18nMark(
              "DC/OS UI has been updated to {version}. Reload the UI for the updated version."
            ),
            {
              version: displayVersion
            }
          );
          const primaryActionText = this._i18n._(i18nMark("Reload"));
          return new ToastNotification(title, {
            appearance: ToastAppearance.Success,
            callback: this.updateAvailableCallback,
            description,
            primaryActionText
          });
        }),
github dcos / dcos-ui / plugins / ui-update / notifications.ts View on Github external
map(() => {
          const title = this._i18n._(i18nMark("UI Rollback Failure"));
          const description = this._i18n._(
            i18nMark("The UI rollback has failed due to an error.")
          );
          const primaryActionText = this._i18n._(i18nMark("Try Again"));
          return new ToastNotification(title, {
            appearance: ToastAppearance.Danger,
            callback: this.rollbackFailedCallback,
            description,
            primaryActionText
          });
        }),
        filter(
github dcos / dcos-ui / plugins / ui-update / notifications.ts View on Github external
map(() => {
          const title = this._i18n._(i18nMark("UI Rollback Failure"));
          const description = this._i18n._(
            i18nMark("The UI rollback has failed due to an error.")
          );
          const primaryActionText = this._i18n._(i18nMark("Try Again"));
          return new ToastNotification(title, {
            appearance: ToastAppearance.Danger,
            callback: this.rollbackFailedCallback,
            description,
            primaryActionText
          });
        }),
        filter(
github dcos / dcos-ui / plugins / ui-update / notifications.ts View on Github external
map(uiMetadata => {
          const displayVersion = semver.coerce(uiMetadata.serverBuild);
          const title = this._i18n._(i18nMark("New UI Available"));
          const description = this._i18n._(
            i18nMark(
              "DC/OS UI has been updated to {version}. Reload the UI for the updated version."
            ),
            {
              version: displayVersion
            }
          );
          const primaryActionText = this._i18n._(i18nMark("Reload"));
          return new ToastNotification(title, {
            appearance: ToastAppearance.Success,
            callback: this.updateAvailableCallback,
            description,
            primaryActionText
          });
        }),
        filter(
github dcos / dcos-ui / plugins / ui-update / notifications.ts View on Github external
map(uiMetadata => {
          const displayVersion = semver.coerce(uiMetadata.serverBuild);
          const title = this._i18n._(i18nMark("New UI Available"));
          const description = this._i18n._(
            i18nMark(
              "DC/OS UI has been updated to {version}. Reload the UI for the updated version."
            ),
            {
              version: displayVersion
            }
          );
          const primaryActionText = this._i18n._(i18nMark("Reload"));
          return new ToastNotification(title, {
            appearance: ToastAppearance.Success,
            callback: this.updateAvailableCallback,
            description,
            primaryActionText
          });
        }),
        filter(
github dcos / dcos-ui / plugins / ui-update / notifications.ts View on Github external
map(() => {
          const title = this._i18n._(i18nMark("UI Rollback Failure"));
          const description = this._i18n._(
            i18nMark("The UI rollback has failed due to an error.")
          );
          const primaryActionText = this._i18n._(i18nMark("Try Again"));
          return new ToastNotification(title, {
            appearance: ToastAppearance.Danger,
            callback: this.rollbackFailedCallback,
            description,
            primaryActionText
          });
        }),
        filter(
github dcos / dcos-ui / plugins / services / src / js / components / modals / ServiceRootGroupModal / Header.tsx View on Github external
export default (props: GroupModalHeaderProps) => {
  const { i18n, mode, onClose, onSave } = props;
  const cancelLabel = i18n._(i18nMark("Cancel"));
  let saveLabel;
  switch (mode) {
    case "create":
      saveLabel = i18n._(i18nMark("Create"));
      break;
    case "edit":
      saveLabel = i18n._(i18nMark("Update"));
      break;
    case "force":
      saveLabel = i18n._(i18nMark("Force Update"));
      break;
  }
  return (
github dcos / dcos-ui / plugins / ui-update / notifications.ts View on Github external
map(uiAction => {
          let notification: ToastNotification;
          const title = this._i18n._(i18nMark("UI Upgrade Failure"));
          const description = this._i18n._(
            i18nMark("The UI upgrade has failed due to an error.")
          );
          const primaryActionText = this._i18n._(i18nMark("Try Again"));
          if (uiAction.value.data !== undefined) {
            const upgradeVersion: string = uiAction.value.data;
            const tryAgainCallback = (
              callbackType: ToastCallbackType,
              toastNotification: ToastNotification
            ) => {
              this.updateFailedCallback(
                callbackType,
                toastNotification,
                upgradeVersion
              );
            };
github dcos / dcos-ui / plugins / services / src / js / components / modals / ServiceRootGroupModal / Header.tsx View on Github external
export default (props: GroupModalHeaderProps) => {
  const { i18n, mode, onClose, onSave } = props;
  const cancelLabel = i18n._(i18nMark("Cancel"));
  let saveLabel;
  switch (mode) {
    case "create":
      saveLabel = i18n._(i18nMark("Create"));
      break;
    case "edit":
      saveLabel = i18n._(i18nMark("Update"));
      break;
    case "force":
      saveLabel = i18n._(i18nMark("Force Update"));
      break;
  }
  return (