How to use the ttag.ngettext function in ttag

To help you get started, we’ve selected a few ttag 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 zzorba / ArkhamCards / components / CardSearchResultsComponent / CardResultList.tsx View on Github external
if (showNonCollection[section.id]) {
      // Already pressed it, so show a button to edit collection.
      return (
github zzorba / ArkhamCards / components / DeckDetailView / CardUpgradeDialog / index.tsx View on Github external
renderCards() {
    const namedCards = this.namedCards();
    const [inCollection, nonCollection] = partition(namedCards, card => this.inCollection(card));
    return (
      <>
        { inCollection.map(card => this.renderCard(card)) }
        { nonCollection.length > 0 ? (
github ttag-org / ttag / examples / webpack-setup / app.js View on Github external
const view = (hours, minutes, seconds) => {
    const hoursTxt = ngettext(msgid`${hours} hour`, `${hours} hours`, hours);
    const minutesTxt = ngettext(msgid`${minutes} minute`, `${minutes} minutes`, minutes);
    const secondsTxt = ngettext(msgid`${seconds} second`, `${seconds} seconds`, seconds);

    return `
    <h1>${ t`webpack with ttag localization demo` }</h1>
    <h2>${ t`Current time is` }</h2>
    <h3>${hoursTxt} ${minutesTxt} ${secondsTxt}</h3>
    `
};
github ttag-org / ttag / examples / webpack-setup / app.js View on Github external
const view = (hours, minutes, seconds) =&gt; {
    const hoursTxt = ngettext(msgid`${hours} hour`, `${hours} hours`, hours);
    const minutesTxt = ngettext(msgid`${minutes} minute`, `${minutes} minutes`, minutes);
    const secondsTxt = ngettext(msgid`${seconds} second`, `${seconds} seconds`, seconds);

    return `
    <h1>${ t`webpack with ttag localization demo` }</h1>
    <h2>${ t`Current time is` }</h2>
    <h3>${hoursTxt} ${minutesTxt} ${secondsTxt}</h3>
    `
};
github cofacts / rumors-site / components / ArticleInfo.js View on Github external
export default function ArticleInfo({ article }) {
  const createdAt = new Date(article.createdAt);
  const { replyRequestCount, replyCount } = article;
  return (
    <div>
      {ngettext(
        msgid`${replyRequestCount} occurence`,
        `${replyRequestCount} occurences`,
        replyRequestCount
      )}
      {article.replyCount &gt; 0 ? (
        <span>          {ngettext(
            msgid`${replyCount} response`,
            `${replyCount} responses`,
            replyCount
          )}
        </span>
      ) : (
        ''
      )}
      {isValid(createdAt) ? (
        <span title="{format(createdAt,">
          ・{formatDistanceToNow(createdAt)}
        </span>
      ) : (
        ''
      )}
      <style>{`</style></div>
github cofacts / rumors-site / components / CurrentReplies.js View on Github external
render() {
    const { items } = this.props;

    if (!items || !items.length) return null;

    const replyLink = (
      <a>
        {ngettext(
          msgid`${items.length} reply`,
          `${items.length} replies`,
          items.length
        )}
      </a>
    );

    return (
      <li>
        <span>{jt`There are ${replyLink} deleted by its author.`}</span>
        {this.renderModal()}

        <style>{`
          li {
            padding: 12px 24px 0;
          }</style></li>

ttag

<div align='center'>

MIT
Latest version published 4 months ago

Package Health Score

78 / 100
Full package analysis