Socket
Book a DemoInstallSign in
Socket

generaltranslation

Package Overview
Dependencies
Maintainers
4
Versions
282
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generaltranslation

A language toolkit for AI developers

7.4.3
latest
Source
npmnpm
Version published
Weekly downloads
2.6K
-0.78%
Maintainers
4
Weekly downloads
 
Created
Source

General Translation

General Translation

This is the core library for General Translation. It is used in gt-react and gt-next.

See our docs for more information including guides, examples, and API references.

Development

Prerequisites

  • Node.js (>= 16.0.0)
  • npm or yarn

Installation

npm install

Testing

This project uses Vitest for testing with two types of tests:

Test Types

  • Unit Tests (__tests__/): Fast, isolated tests with mocking

Running Tests

# Run all tests (unit + e2e)
npm test

# Run only unit tests
npm test -- __tests__

# Run tests in watch mode
npm run test:watch

# Run specific test file
npm test -- __tests__/logging/logger.test.ts

# Run tests matching a pattern
npm test -- -t "should handle translation"

Environment Variables

Required for E2E Tests

Create a .env file in the project root with:

# GT API Configuration
VITE_GT_API_KEY="your-dev-api-key"
VITE_GT_PROJECT_ID="your-project-id"
VITE_GT_RUNTIME_URL="http://localhost:10000"

Note: E2E tests require a running GT runtime server at the specified URL. Without proper configuration, e2e tests will skip gracefully.

Optional: Logger Configuration

# Set logging level for development/debugging
_GT_LOG_LEVEL=debug  # Options: debug, info, warn, error (default: warn)

Test Configuration

  • Parallel Execution: Tests run in parallel using 2-4 threads for optimal performance
  • Timeout: 15 seconds per test (suitable for network-dependent e2e tests)
  • Environment: Node.js environment for testing

Example Test Commands

# Development workflow
_GT_LOG_LEVEL=debug npm test --reporter=verbose

# Quick unit test validation
npm test -- __tests__

# Test specific functionality
npm test -- -t "logger" --reporter=verbose

# Watch mode for development
npm run test:watch -- __tests__/

Test Structure

__tests__/           # Unit tests with mocking
├── logging/         # Logger functionality tests
└── translate/       # Translation logic tests

Contributing

We welcome any contributions to our libraries. Please submit a pull request!

Development Workflow

  • Install dependencies: npm install
  • Set up environment variables (see Testing section)
  • Run tests: npm test
  • Make your changes
  • Run tests again to ensure everything works
  • Submit a pull request

Keywords

language

FAQs

Package last updated on 02 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.