Skip to content

General-Translation/gt-libraries

Repository files navigation

General Translation

Overview

General Translation is a one-stop solution for all your translation needs. It includes:

  • A set of libraries for React and Next.js
  • A translation platform
  • A free AI-powered translation service

With General Translation, you never need to worry about localization again. Just install the libraries in your project, wrap your content as you code, and we'll take care of the rest.

With General Translation, you can internationalize your entire app in minutes.

Get started at generaltranslation.com!

Full documentation, including guides, examples, and API references, can be found in the docs.

Join our Discord community to get help and stay updated!

Library Features

⚛️ Translate entire React components, not just strings

  • Just wrap your content in a <T> component!
  • No need for complex refactoring or messy function calls.
export default function Page() {
  return (
    <T>
      <p>You can write any JSX as children of the {'<T>'} component.</p>
      <p>
        For example, you could write a <a href='/'>link</a> and have the text be
        translated in context.
      </p>
      <div>
        <div>
          <p>Even deeply nested components are translated in context.</p>
          <button>Click me!</button>
        </div>
      </div>
    </T>
  );
}

🔎 Feature parity with existing libraries

  • GT libraries also support the same features as existing libraries like i18next, react-intl, and next-intl.
  • Features such as dictionaries, plurals, currencies, and automatic routing are all supported.

🔧 Developer-friendly

  • Setup is simple and can be done in minutes.
  • All GT libraries are open-source and work standalone.
    • You can use your own translation provider or use our free AI-powered translation service.
  • No more wasting time managing translation keys like t('menu.header.title').
    • Just write everything in-line!

🧠 Free AI-powered translation service

  • Libraries integrate natively with our translation platform.
  • Translations are generated for your app in seconds.
  • HTML content is re-arranged and customized according to the language.
  • Translations are generated on-demand, so you can view them in real-time in development.

Examples

See the examples directory for some example projects that use our libraries. We currently support React and Next.js.

Simple interface for native pluralization and conditional logic:

<Plural
  n={count}
  singular={<>There is {count} item</>}
  plural={<>There are {count} items</>}
/>

Support for translation at runtime:

export default function Comment() {
  const comment = await getComment();

  return (
    <h1>Author: {comment.author}</h1>
    <Tx>
      <p>{comment.content}</p>
    </Tx>
  );
}

Intuitive i18n formatting syntax:

return (
  <T>
    <h1> Your account information: </h1>
    Account balance: <Currency>{account.bal}</Currency> // Currency Formatting
    <br />
    Updated at: <DateTime>{account.updateTime}</DateTime> // Datetime Formatting
    <br />
    Transactions this month: <Num>{account.txCount}</Num> // Number Formatting
  </T>
);

Libraries

See the below for links to the relevant libraries:

Installation

Any of the libraries can be installed via npm, yarn, pnpm, or bun.

For example, to install gt-next:

npm install gt-next
yarn add gt-next

Usage of the libraries is documented on our docs.

Contributing

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