@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 exports these translations to other libraries or frameworks.
Installation
Install the library using npm:
npm install "@grams-dev/i18n" --save
Usage
i18n
Object
1. Import the In your index.html
, import the i18n
object from @grams-dev/i18n
to access the translation strings
import '@grams-dev/i18n';
2. Using the hook
Using the hook in functional components is one of the options you have.
The t
function is the main function in i18next
to translate content.
import React from 'react';
// the hook
import { useTranslation } from 'react-i18next';
function MyComponent () {
const { t, i18n } = useTranslation();
return <h1>{t('Welcome to React')}</h1>
}
Learn more about the hook useTranslation.
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 Apache-2.0 License. Feel free to use, modify, and distribute it as needed.