How to use the i18next.default.t function in i18next

To help you get started, we’ve selected a few i18next 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 TerriaJS / terriajs / lib / Models / CkanCatalogItem.js View on Github external
if (itemData.notes) {
    newItem.info.push({
      name: i18next.t("models.ckan.datasetDescription"),
      content: itemData.notes
    });

    // Prevent a description - often the same one - from also coming from the WMS server.
    newItem.info.push({
      name: i18next.t("models.ckan.datasetDescription"),
      content: ""
    });
  }

  if (defined(resource.description)) {
    newItem.info.push({
      name: i18next.t("models.ckan.resourceDescription"),
      content: resource.description
    });
  }

  if (defined(itemData.license_url)) {
    newItem.info.push({
      name: i18next.t("models.ckan.licence"),
      content:
        "[" +
        (itemData.license_title || itemData.license_url) +
        "](" +
        itemData.license_url +
        ")"
    });
  } else if (defined(itemData.license_title)) {
    newItem.info.push({
github TerriaJS / terriajs / lib / Models / CkanCatalogItem.js View on Github external
content: itemData.c
    });
  }

  // If the date string is of format 'dddd-dd-dd*' extract the first part, otherwise we retain the entire date string.
  function prettifyDate(date) {
    if (date.match(/^\d\d\d\d-\d\d-\d\d.*/)) {
      return date.substr(0, 10);
    } else {
      return date;
    }
  }

  if (defined(itemData.metadata_created)) {
    newItem.info.push({
      name: i18next.t("models.ckan.metadata_created"),
      content: prettifyDate(itemData.metadata_created)
    });
  }

  if (defined(itemData.metadata_modified)) {
    newItem.info.push({
      name: i18next.t("models.ckan.metadata_modified"),
      content: prettifyDate(itemData.metadata_modified)
    });
  }

  if (defined(itemData.update_freq)) {
    newItem.info.push({
      name: i18next.t("models.ckan.update_freq"),
      content: itemData.update_freq
    });
github autowp / autowp / assets / widget / picture-moder-vote.js View on Github external
}

        if (reason) {
            send(reason, vote, 0, function () {
                window.location = window.location;
            });
        } else {
            var $modal = $(require('./picture-moder-vote/modal.html'));

            var $btnSend = $modal.find('.btn-send');
            var $btnCancel = $modal.find('.btn-secondary');
            var $checkboxLabel = $modal.find('.checkbox span');

            $btnSend.addClass(vote > 0 ? 'btn-success' : 'btn-danger');

            $modal.find('.modal-title').text(i18next.t("picture-moder-vote/custom/title"));
            $btnSend.attr('data-loading-text', i18next.t("picture-moder-vote/custom/sending"));
            $btnSend.text(i18next.t("picture-moder-vote/custom/send"));
            $btnCancel.text(i18next.t("picture-moder-vote/custom/cancel"));
            $checkboxLabel.text(i18next.t("picture-moder-vote/custom/save"));

            var $reason = $modal.find(':input[name=reason]');

            $modal.on('shown.bs.modal', function () {
                $reason.focus();
            });

            $btnSend.on('click', function () {
                reason = $reason.val();
                if (reason) {
                    // $(this).button('loading');
                    var save = $modal.find(':input[name=save]').val();
github TerriaJS / terriajs / lib / Models / GeoJsonCatalogItem.js View on Github external
} else {
          var jsonPromise;
          if (zipFileRegex.test(that.url)) {
            if (typeof FileReader === "undefined") {
              throw new TerriaError({
                sender: that,
                title: i18next.t("models.geoJson.unsupportedBrowserTitle"),
                message: i18next.t("models.geoJson.unsupportedBrowserMessage", {
                  appName: that.terria.appName,
                  chrome:
                    '<a href="http://www.google.com/chrome">' +
                    i18next.t("models.geoJson.chrome") +
                    "</a>",
                  firefox:
                    '<a href="http://www.mozilla.org/firefox">' +
                    i18next.t("models.geoJson.firefox") +
                    "</a>",
                  internetExplorer:
                    '<a href="http://www.microsoft.com/ie">' +
                    i18next.t("models.geoJson.internetExplorer") +
                    "</a>"
                })
              });
            }

            jsonPromise = loadBlob(
              proxyCatalogItemUrl(that, that.url, "1d")
            ).then(function(blob) {
              var deferred = when.defer();
              zip.createReader(
                new zip.BlobReader(blob),
                function(reader) {
github TerriaJS / terriajs / lib / Models / CkanCatalogItem.js View on Github external
newItem.info.push({
      name: i18next.t("models.ckan.metadata_created"),
      content: prettifyDate(itemData.metadata_created)
    });
  }

  if (defined(itemData.metadata_modified)) {
    newItem.info.push({
      name: i18next.t("models.ckan.metadata_modified"),
      content: prettifyDate(itemData.metadata_modified)
    });
  }

  if (defined(itemData.update_freq)) {
    newItem.info.push({
      name: i18next.t("models.ckan.update_freq"),
      content: itemData.update_freq
    });
  }

  newItem.url = url;

  var bboxString = itemData.geo_coverage || extras.geo_coverage;
  if (defined(bboxString)) {
    var parts = bboxString.split(",");
    if (parts.length === 4) {
      newItem.rectangle = Rectangle.fromDegrees(
        parts[0],
        parts[1],
        parts[2],
        parts[3]
      );
github TerriaJS / terriajs / lib / Models / GeoJsonCatalogItem.js View on Github external
}).otherwise(function() {
              throw new TerriaError({
                sender: that,
                title: i18next.t("models.geoJson.errorLoadingTitle"),
                message: i18next.t("models.geoJson.errorLoadingMessage", {
                  appName: that.terria.appName,
                  email:
                    '<a href="mailto:' +
                    that.terria.supportEmail +
                    '">' +
                    that.terria.supportEmail +
                    "</a>."
                })
              });
            });
          });
github TerriaJS / terriajs / lib / Models / CkanCatalogItem.js View on Github external
: undefined,
          dataCustodian: that.dataCustodian,
          itemProperties: that.itemProperties
        });

        if (defined(catalogItem)) {
          catalogItem.name = that.name;
          return catalogItem;
        }
      }

      throw new TerriaError({
        sender: that,
        title: i18next.t("models.ckan.notCompatibleTitle"),
        message: defined(that.resourceId)
          ? i18next.t("models.ckan.notCompatibleMessageI", {
              resourceId: that.resourceId
            })
          : i18next.t("models.ckan.notCompatibleMessageII")
      });
    });
  });
github TerriaJS / terriajs / lib / Models / CkanCatalogItem.js View on Github external
sender: that,
          title: i18next.t("models.ckan.errorRetrievingUrlTitle"),
          message: i18next.t("models.ckan.errorRetrievingUrlMessage", {
            url: that.url
          })
        });
      }

      if (
        !defined(resourceJson.result) ||
        !defined(resourceJson.result.package_id)
      ) {
        throw new TerriaError({
          sender: that,
          title: i18next.t("models.ckan.invalidCkanTitle"),
          message: i18next.t("models.ckan.invalidCkanMessage")
        });
      }

      return resourceJson.result.package_id;
    });
  }
github TerriaJS / terriajs / lib / Models / GeoJsonCatalogItem.js View on Github external
.otherwise(function(e) {
              if (e instanceof TerriaError) {
                throw e;
              }

              throw new TerriaError({
                sender: that,
                title: i18next.t("models.geoJson.couldNotLoadTitle"),
                message: i18next.t("models.geoJson.couldNotLoadMessage", {
                  cors:
                    '<a href="http://enable-cors.org/">CORS</a>',
                  email:
                    '<a href="mailto:' +
                    that.terria.supportEmail +
                    '">' +
                    that.terria.supportEmail +
                    "</a>."
                })
              });
            });
        }
github TerriaJS / terriajs / lib / Models / CkanCatalogItem.js View on Github external
datasetIdPromise = loadJson(resourceUrl).then(function(resourceJson) {
      if (!resourceJson.success) {
        throw new TerriaError({
          sender: that,
          title: i18next.t("models.ckan.errorRetrievingUrlTitle"),
          message: i18next.t("models.ckan.errorRetrievingUrlMessage", {
            url: that.url
          })
        });
      }

      if (
        !defined(resourceJson.result) ||
        !defined(resourceJson.result.package_id)
      ) {
        throw new TerriaError({
          sender: that,
          title: i18next.t("models.ckan.invalidCkanTitle"),
          message: i18next.t("models.ckan.invalidCkanMessage")
        });
      }