Types

GTConstructorParams

TypeScript interface for GT class constructor parameters

Overview

GTConstructorParams defines configuration options for GT class initialization.

interface GTConstructorParams {
  apiKey?: string;
  devApiKey?: string;
  sourceLocale?: string;
  targetLocale?: string;
  locales?: string[];
  projectId?: string;
  baseUrl?: string;
  customMapping?: CustomMapping;
}

All properties are optional. The constructor reads GT_API_KEY, GT_DEV_API_KEY, and GT_PROJECT_ID from environment variables if not provided.

Properties

PropertyTypeDescription
apiKey?stringProduction API key
devApiKey?stringDevelopment API key
sourceLocale?stringDefault source locale
targetLocale?stringDefault target locale
locales?string[]Supported locale codes
projectId?stringProject identifier
baseUrl?stringCustom API endpoint
customMapping?CustomMappingCustom locale mappings

Examples

Basic Setup

const gt = new GT({
  apiKey: 'your-api-key',
  sourceLocale: 'en',
  targetLocale: 'es',
  locales: ['en', 'es', 'fr']
});

With Environment Variables

const gt = new GT({
  sourceLocale: 'en',
  targetLocale: 'es'
});
// Uses GT_API_KEY and GT_PROJECT_ID from environment

How is this guide?

GTConstructorParams