# translate-package

> A package for translating i18 objects to other languages

Latest version **0.0.3** (published 2021-11-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install translate-package
pnpm add translate-package
yarn add translate-package
bun add translate-package
```

Provides the command `generate`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-11-07 |
| First published | 2021-10-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 59.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Amin Jafarlou |
| Maintainers | aminjafarlou |
| Keywords | internationalization, localization, globalization, translate, i18next, react-i18next, react, reactjs |

## Links

- npm: https://www.npmjs.com/package/translate-package
- Repository: https://github.com/AminJafarlou/Translate-Package
- Issues: https://github.com/AminJafarlou/Translate-Package/issues
- npm.io page: https://npm.io/package/translate-package

## Dependencies (3)

- [prettier](https://npm.io/package/prettier.md) ^2.4.1
- [@types/prettier](https://npm.io/package/@types/prettier.md) ^2.4.1
- [translate-google](https://npm.io/package/translate-google.md) ^1.5.0

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2021-11-07
- 0.0.2 — 2021-10-30
- 0.0.1 — 2021-10-28

## README

<!-- TABLE OF CONTENTS -->
<details open="open">
  <summary>Table of Contents</summary>
  <ol>
    <li>
      <a href="#about-translate-package">About Translate Package</a>
    </li>
    <li>
      <a href="#installation">Installation</a>
    </li>
    <li><a href="#usage">Usage</a></li>
    <li><a href="#examples">Examples</a></li>
    <li><a href="#contributing">Contributing</a></li>
    <li><a href="#contact">Contact</a></li>
    <li><a href="#acknowledgements">Acknowledgements</a></li>
  </ol>
</details>

<!-- ABOUT THE PROJECT -->

# About Translate-Package

If you are planning to build an application which can support multiple languages, translate-package will help you automate the process of translation of words.
With most popular packages that internationalize your application, several resources files should be generated for each language. However, it is most likely that you as a developer do not know all the words you need at all languages, and you might use Google Translate. Translating each word with Google Translate can be very time consuming as well as boring for most, if not all, of developers.
Here is where Translate-Package comes into play. Translate-package will get an initial file from the source language you know and generate a source file for all your other desired languages.

### Pros

- Type-Safe
- Light-weight package
- Auto-generation of files
- Supporting dozens of languages

## Installation

- npm

  ```sh
  npm install translate-package
  ```

- yarn
  ```sh
  yarn add translate-package
  ```

## Usage

First, you need to create a config file named "localize.config.json" in your project's root directory.
This config file must contain the following:

- Address to your source file
- Address in which files are generated
- Desired output languages (array of strings)

For Example:

```json
{
  "source": "./test/fa.js",
  "out": "./test",
  "languages": ["en", "fr", "es"]
}
```

## Second, you have to provide your source file, in the directory mentioned in config file.

**NOTE!**

Your source file must have following features:

- Be an object
- A JavaScript File
- Have an acceptable name, for example: (en.js, fr.js, es.js, ...)

---

## Examples

Source File (in English):

```js
const en = {
  aboutUse: 'about us',
  actions: 'actions',
  address: 'Address',
  air: 'Air',
  all: 'Total',
  amount: 'Amount',
  buy: 'Buy',
  changePassword: 'change Password',
  classic: 'Classic',
  confirm: 'confirm',
  delete: 'Delete',
  edit: 'Edit',
  fee: 'fee',
  method: 'Method',
  price: 'Price',
  search: 'Search',
  type: 'Type',
  yesterday: 'Yesterday',
};
```

Output File (in French):

```js
const fr = {
  aboutUse: 'à propos de nous',
  actions: "l'opération",
  address: 'Adresse',
  air: 'Air',
  all: 'Le total',
  amount: 'Montant',
  buy: 'Acheter',
  changePassword: 'changer le mot de passe',
  classic: 'Classique',
  confirm: 'Confirmé',
  delete: 'Effacer',
  edit: 'Éditer',
  fee: 'Salaire',
  method: 'Méthode',
  price: 'Prix',
  search: 'Chercher',
  type: 'Taper',
  yesterday: 'Hier',
};
```

<!-- CONTACT -->

## Contact

Amin Jafarlou: jafarlou.amin@gmail.com
Project Link: [https://github.com/aminjafarlou/translate-package](https://github.com/aminjafarlou/translate-package)

<!-- ACKNOWLEDGEMENTS -->

## Acknowledgements

---
_Source: https://npm.io/package/translate-package · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
