1.0.3-build • Published 5 months ago

vogzcorp-react-trad v1.0.3-build

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

React-Trad by VogzCorp

The package is public but you do not have the right to modify or create extensions of this code. If you need more fonctionnality you can come in vogzcorp.fr (not yet publish);

npm i vogzcorp-react-trad
npm i vogzcorp-react-trad@latest
import { useTranslate, LangMenu } from "vogzcorp-react-trad"

//instead of a constant, you can use a default import from a json file with the same structure as below
//You can already download example json files on https://vogzcorp.fr/pages/entreprises/vogzcorpdev/modules/react-trad/json/exemple/download

const data = {
  en: {
    main: {
      header: {
        content: {
          h1: "this is an h1 content"
        }
      }
    }
  },
  fr: {
    main: {
      header: {
        content: {
          h1: "ceci est un contenu h1"
        }
      }
    }
  }
}

export function Header() {
  const changelang = new useTranslate(data, document.querySelector("html")?.lang)
  //about the t() function, ⚠️ be careful, your path argument must contain at least 4 elements like opposite `t("main/header/content/h1")`

  return (
    <h1>{changelang.t("main/header/content/h1")}</h1> //if the value of html lang argument is "fr", the content of this balise is in french.
    <LangMenu />    
  )
}
1.1.7-build

5 months ago

1.1.8-build

5 months ago

1.1.6-build

5 months ago

1.1.5-build

9 months ago

1.1.4-build

9 months ago

1.1.3-build

9 months ago

1.1.2-build

9 months ago

1.1.1-build

9 months ago

1.1.0-build

9 months ago

1.0.9-build

9 months ago

1.0.8-build

9 months ago

1.0.7-build

9 months ago

1.0.6-build

9 months ago

1.0.5-build

9 months ago

1.0.3-build

9 months ago

1.0.2

9 months ago