8000 GitHub - generaltranslation/gt: βš›οΈ A developer-friendly one stop shop to localization 🌐
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

βš›οΈ A developer-friendly one stop shop to localization 🌐

License

Notifications You must be signed in to change notification settings

generaltranslation/gt

Repository files navigation

General Translation

General Translation (GT) is a one-stop solution for launching software in multiple languages.

The full GT stack includes:

  • Open source developer libraries
  • Context-aware translation APIs
  • A platform for translation management

Install the libraries in your project, add <T> tags, and see translations as you code:

Demo

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

Create an API key at generaltranslation.com!

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 managing JSON files.
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 next-intl and react-i18next.
  • 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 managing translation keys like t('menu.header.title').
    • Just write everything in-line!

🧠 Free, context-aware AI translation service

  • Translation hot reload in development
  • 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.

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 <Num>{count}</Num> item</>}
  plural={<>There are <Num>{count}</Num> 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

See our docs for more information.

Contributing

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

0