Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rodrigooler/i18nh
i18nh - (I18n Hook) i18n simplified and made to solve the problem of internationalization using the concept of hook (react)
https://github.com/rodrigooler/i18nh
angular cordova create-react-app hooks i18n i18n-js i18n-node i18nh javascript js nativescript phonegap react react-hook react-native reactnative ssr ts typescript vue
Last synced: about 2 months ago
JSON representation
i18nh - (I18n Hook) i18n simplified and made to solve the problem of internationalization using the concept of hook (react)
- Host: GitHub
- URL: https://github.com/rodrigooler/i18nh
- Owner: rodrigooler
- License: mit
- Created: 2018-10-31T06:56:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T21:17:39.000Z (almost 2 years ago)
- Last Synced: 2024-10-17T22:46:11.810Z (2 months ago)
- Topics: angular, cordova, create-react-app, hooks, i18n, i18n-js, i18n-node, i18nh, javascript, js, nativescript, phonegap, react, react-hook, react-native, reactnative, ssr, ts, typescript, vue
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/i18nh
- Size: 3.28 MB
- Stars: 38
- Watchers: 1
- Forks: 2
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DEPRECATED because the initial idea was to have an alternative to using i18n with hooks, but now i18next is indicated and recommended!
https://react.i18next.com/
## Install
## Support
- [x] NodeJS
- [x] React
- [x] NextJS
- [x] Create React App 1.0
- [x] Create React App 2.0
- [x] React Native
- [x] PhoneGap / Cordova
- [x] Angular
- [x] Vue
- [x] NativeScript#### NPM
```bash
npm install i18nh --save
```#### YARN
```bash
yarn add i18nh
```## Use
To use it is simple just look at the steps below
```js
import i18nh, { useT } from 'i18nh'// Create a language object containing the
// translations as in the example below
const languages = {
en: {
hello: 'Hello',
about: 'About',
goodMorning: 'Good Morning',
},
pt: {
hello: 'Olá',
about: 'Sobre',
goodMorning: 'Bom Dia',
},
}// i18nh load the language object containing
// the translations and also the default language argument
i18nh({
languages,
defaultLanguage: 'en'
});const [t] = useT();
console.log(t('hello'))
// Hello
console.log(t('about'))
// About
console.log(t('goodMorning'))
// Good Morningconsole.log(t('hello', 'pt'))
// Olá
console.log(t('about', 'pt'))
// Sobre
console.log(t('goodMorning', 'pt'))
// Bom Dia
```