GithubHelp home page GithubHelp logo

ah-locale-json's Introduction

Contributing

For non-developers:

If you want to contribute to this project and only want to add language, please read the contributing guide.

For developers:

This is a translation package for Agency Handy

Agency Handy is a Saas application to manage your clients, teams and invoices in one place.

Installation

npm install --save ah-locale-json

Usage

To import all the locale files, use the following code

import locale from 'ah-locale-json'

To import only frontend or backend files, use the following code

import locale from 'ah-locale-json/dist/frontend'
import locale from 'ah-locale-json/dist/backend'

To import only a specific locale file, use the following code

import locale from 'ah-locale-json/dist/frontend/en'
import locale from 'ah-locale-json/dist/backend/en'

Usage in React

Setting up i18next.

import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import { LANGUAGE } from '../constants/settings'
import locale from 'ah-locale-json/frontend'

i18n.use(initReactI18next).init({
  resources: {
    en: {
      translation: locale.en,
    },
    bn: {
      translation: locale.bn,
    },
    // other languages
  },
  lng: LANGUAGE.ENGLISH,
  fallbackLng: LANGUAGE.ENGLISH,
  interpolation: {
    escapeValue: false,
  },
})

export default i18n

Passing the i18n instance to the provider.

import React from 'react'
import { I18nextProvider } from 'react-i18next'
import { i18n } from './i18n'

const App = () => {
  return (
    <I18nextProvider i18n={i18n}>
      <App />
    </I18nextProvider>
  )
}

Using the t function in the component.

import React from 'react'
import { useTranslation } from 'react-i18next'

const Emample = () => {
  const { t } = useTranslation()

  return <h1>{t('AGENCY_HANDY')}</h1>
}

License

No license, you can use it however you want.

ah-locale-json's People

Contributors

jbordhen avatar orvi2014 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.