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;
}| Property | Type | Description |
|---|---|---|
shouldSetupProject | boolean | true if project set-up is required, false if already set up |
Examples
Basic usage
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
setupProjectneeds to be called - Projects typically need setting up when they’re newly created or when significant structural changes are made
Next steps
- See
setupProjectto perform setup if required - See
checkSetupStatusto monitor setup progress - See
enqueueFilesto start translations after setup - See
uploadSourceFilesto upload files before setup
How is this guide?