lib/commands/utils/build-pot-file.js
function groupGettextItems(gettextItems) {
  return gettextItems
    .filter((item) => item.messageId) // filter out items without message id
    .sort((item1, item2) => {
      return (
        item1.loc.fileName.localeCompare(item2.loc.fileName) ||
        item1.loc.line - item2.loc.line
      );
    })
    .reduce((allGroups, item) => {
      let group = allGroups.find((group) => {
        return (
          group.messageId === item.messageId &&
          group.messageContext === item.messageContext
        );
      });

      if (group) {
        group.locs.push(item.loc);

        // Although it is an edge case, it is possible for two translations to have the same messageID
        // while only one of them has a plural
        // For example: {{t 'Find item'}} {{n 'Find item' 'Find items' count}}
        // For such a case, we make sure to also add the plural, if it was previously missing
        if (!group.messageIdPlural && item.messageIdPlural) {
          group.messageIdPlural = item.messageIdPlural;
        }
      } else {
        group = Object.assign({}, item);
        group.locs = [item.loc];
        delete group.loc;
        allGroups.push(group);
      }

      return allGroups;
    }, []);
}
function groupGettextItems(gettextItems) {
  return gettextItems
    .filter((item) => item.messageId) // filter out items without message id
    .sort((item1, item2) => {
      return (
        item1.loc.fileName.localeCompare(item2.loc.fileName) ||
        item1.loc.line - item2.loc.line
      );
    })
    .reduce((allGroups, item) => {
      let group = allGroups.find((group) => {
        return (
          group.messageId === item.messageId &&
          group.messageContext === item.messageContext
        );
      });

      if (group) {
        group.locs.push(item.loc);

        // Although it is an edge case, it is possible for two translations to have the same messageID
        // while only one of them has a plural
        // For example: {{t 'Find item'}} {{n 'Find item' 'Find items' count}}
        // For such a case, we make sure to also add the plural, if it was previously missing
        if (!group.messageIdPlural && item.messageIdPlural) {
          group.messageIdPlural = item.messageIdPlural;
        }
      } else {
        group = Object.assign({}, item);
        group.locs = [item.loc];
        delete group.loc;
        allGroups.push(group);
      }

      return allGroups;
    }, []);
}
Group equal entries together The generated groups look like the given gettextItems, only that they have `locs` instead of `loc` Where `locs` is an array of `loc` entries, having a `fileName`, `line` and `column`.