<commit_before>// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

import fse from 'fs-extra';
import path from 'path';
import type { AfterPackContext } from 'electron-builder';

export async function afterPack({
  appOutDir,
  packager,
  electronPlatformName,
}: AfterPackContext): Promise<void> {
  let defaultLocale: string;
  let ourLocales = await fse.readdir(
    path.join(__dirname, '..', '..', '_locales')
  );

  let localesPath: string;
  if (electronPlatformName === 'darwin') {
    const { productFilename } = packager.appInfo;

    // en.lproj/locale.pak
    // zh_CN.lproj/locale.pak
    defaultLocale = 'en.lproj';
    ourLocales = ourLocales.map(locale => `${locale}.lproj`);

    localesPath = path.join(
      appOutDir,
      `${productFilename}.app`,
      'Contents',
      'Frameworks',
      'Electron Framework.framework',
      'Resources'
    );
  } else if (<commit_msg>Change location of copied language packs<commit_after>// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

import fse from 'fs-extra';
import path from 'path';
import type { AfterPackContext } from 'electron-builder';

export async function afterPack({
  appOutDir,
  packager,
  electronPlatformName,
}: AfterPackContext): Promise<void> {
  let defaultLocale: string;
  let ourLocales = await fse.readdir(
    path.join(__dirname, '..', '..', '_locales')
  );

  let localesPath: string;
  if (electronPlatformName === 'darwin') {
    const { productFilename } = packager.appInfo;

    // en.lproj/locale.pak
    // zh_CN.lproj/locale.pak
    defaultLocale = 'en.lproj';
    ourLocales = ourLocales.map(locale => `${locale}.lproj`);

    localesPath = path.join(
      appOutDir,
      `${productFilename}.app`,
      'Contents',
      'Resources'
    );
  } else if (
{'fraction_non_alphanumeric': 0.14051394204483325, 'fraction_numerical': 0.0065609622744669215, 'mean_word_length': 3.3990384615384617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4649168', 'n_tokens_mistral': 614, 'n_tokens_neox': 587, 'n_words': 134}