open-index/open-npm huggingface dataset:
npm package: @grams.dev/i18n
Description: A localization and internationalization library for Grams applications.
Author: Grams Foundation
Latest version: 0.0.2

# @grams.dev/i18n

A localization and internationalization library for Grams applications.

## Overview

The `@grams.dev/i18n` library provides a simple and efficient way to manage translations and internationalization in Grams applications. It stores translation strings in JSON files and offers a command-line interface (CLI) to export these translations to other libraries or frameworks.

## Installation

Install the library using npm:

```bash
npm install "@grams.dev/i18n"
```

## Usage

### 1. Import the `i18n` Object

In your React components or application code, import the `i18n` object from `@grams.dev/i18n` to access the translation strings:

```jsx
import { i18n } from '@grams.dev/i18n';

// Example usage in a React component:
const GreetingComponent = () => {
  return <div>{i18n.t('greeting')}</div>;
};
```

### 3. CLI for Exporting Translations

The `@grams.dev/i18n` library provides a CLI tool to export translations to other popular libraries or frameworks. You can use the following command to export the translations:

```bash
npx grams-i18n export
```

This will generate language-specific JSON files for each translation in the `exported-translations` directory. You can then use these files in other libraries or frameworks to enable internationalization in your Grams application.

## Contributing

We welcome contributions from the community to improve and expand the functionality of the `@grams.dev/i18n` library. If you find any issues or have suggestions, please create a pull request or open an issue on our GitHub repository.

## License

This library is open-source and available under the [MIT License](LICENSE). Feel free to use, modify, and distribute it as needed.