GT ClassMethodsTranslation

shouldSetupProject

API reference for the shouldSetupProject method to check whether project setup is required

Overview

The shouldSetupProject method checks whether a project needs setup before translation jobs can be enqueued. This method queries the API to determine whether the project has been properly initialised and configured for translation workflows.

const gt = new GT({ projectId: 'your-project-id', apiKey: 'your-api-key' });

const result = await gt.shouldSetupProject();
if (result.shouldSetupProject) {
  console.log('Project setup is required');
} else {
  console.log('Project is ready for translations');
}

Reference

Parameters

None — this method uses the GT instance configuration to check the project.

Returns

Promise<ShouldSetupProjectResult> – Contains a boolean indicating whether setup is required.

type ShouldSetupProjectResult = {
  shouldSetupProject: boolean;
}
PropertyTypeDescription
shouldSetupProjectbooleantrue if project set-up is required, false if already set up

Examples

Basic usage

index.ts
import { GT } from 'generaltranslation';

const gt = new GT({
  apiKey: 'your-api-key',
  projectId: 'my-project'
});

async function checkProjectStatus() {
  const result = await gt.shouldSetupProject();
  
  if (result.shouldSetupProject) {
    console.log('Project requires setup');
    return 'setup-required';
  } else {
    console.log('Project is ready for translations');
    return 'ready';
  }
}

const status = await checkProjectStatus();

Notes

  • The result determines whether setupProject needs to be called
  • Projects typically need setting up when they’re newly created or when significant structural changes are made

Next steps

How is this guide?

shouldSetupProject