packages/slate-translations/index.js
async function createSchemaContentWithLocales(localizedSchema, mainSchemaPath) {
  // eslint-disable-next-line func-style
  const traverse = async (obj) => {
    const objectKeys = Object.keys(obj);
    await Promise.all(
      objectKeys.map(async (key) => {
        if (typeof obj[key].t === 'string') {
          obj[key] = await _getLocalizedValues(obj[key].t, localizedSchema);
        } else if (typeof obj[key] === 'object') {
          await traverse(obj[key]);
        }
      }),
    );
    return JSON.stringify(obj, null, 2);
  };
  const mainSchema = await fs.readJSON(mainSchemaPath, 'utf-8');
  return traverse(mainSchema);
}
async function createSchemaContentWithLocales(localizedSchema, mainSchemaPath) {
  // eslint-disable-next-line func-style
  const traverse = async (obj) => {
    const objectKeys = Object.keys(obj);
    await Promise.all(
      objectKeys.map(async (key) => {
        if (typeof obj[key].t === 'string') {
          obj[key] = await _getLocalizedValues(obj[key].t, localizedSchema);
        } else if (typeof obj[key] === 'object') {
          await traverse(obj[key]);
        }
      }),
    );
    return JSON.stringify(obj, null, 2);
  };
  const mainSchema = await fs.readJSON(mainSchemaPath, 'utf-8');
  return traverse(mainSchema);
}
async function createSchemaContentWithLocales ( localizedSchema , mainSchemaPath ) { // eslint-disable-next-line func-style const traverse = async ( obj ) => { const objectKeys = Object . keys ( obj ) ; await Promise . all ( objectKeys . map ( async ( key ) => { if ( typeof obj [ key ] . t === 'string' ) { obj [ key ] = await _getLocalizedValues ( obj [ key ] . t , localizedSchema ) ; } else if ( typeof obj [ key ] === 'object' ) { await traverse ( obj [ key ] ) ; } } ) , ) ; return JSON . stringify ( obj , null , 2 ) ; } ; const mainSchema = await fs . readJSON ( mainSchemaPath , 'utf-8' ) ; return traverse ( mainSchema ) ; }
Goes through the main schema to get the translation keys and to fill the schema with translations

@param {*} localizedSchema The schema with the combined locales
@param {*} mainSchemaPath The path to the main schema (schema.json)
@returns
Goes through the main schema to get the translation keys and to fill the schema with translations