All Projects → alii → react-text-translator

alii / react-text-translator

Licence: other
An experimental way to translate text inside React components with context

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-text-translator

React Translated
A dead simple way to add complex translations (i18n) in a React (DOM/Native) project 🌎🌍🌏
Stars: ✭ 176 (+1073.33%)
Mutual labels:  i18n, translate
Deeply
PHP client for the DeepL.com translation API (unofficial)
Stars: ✭ 152 (+913.33%)
Mutual labels:  i18n, translate
Texterify
The localization management system.
Stars: ✭ 37 (+146.67%)
Mutual labels:  i18n, translate
vue-translated
Internationalization (i18n) and localization (l10n) library for Vue.js v2.
Stars: ✭ 19 (+26.67%)
Mutual labels:  i18n, translate
background-translation-i18n
Based on the YII2 module to translate JSON formatted translation files on the web
Stars: ✭ 11 (-26.67%)
Mutual labels:  i18n, translate
Flutter translate
Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
Stars: ✭ 245 (+1533.33%)
Mutual labels:  i18n, translate
React Intl Hooks
React hooks for internationalization without the hassle ⚛️🌍
Stars: ✭ 64 (+326.67%)
Mutual labels:  i18n, translate
deepl-php-lib
🧠 DeepL API Client Library supporting PHP >= 7.3
Stars: ✭ 50 (+233.33%)
Mutual labels:  i18n, translate
translate-go
https://babyblue94520.github.io/translate-go/dist/
Stars: ✭ 14 (-6.67%)
Mutual labels:  i18n, translate
tr4n5l4te
Use Google Translate without an API key.
Stars: ✭ 32 (+113.33%)
Mutual labels:  i18n, translate
nuxt-i18n-boilerplate
A boilerplate for rapid application development using Nuxt i18n.
Stars: ✭ 20 (+33.33%)
Mutual labels:  i18n
mini-create-react-context
(A smaller) polyfill for the react context API
Stars: ✭ 34 (+126.67%)
Mutual labels:  context
craft-text-detector
Packaged, Pytorch-based, easy to use, cross-platform version of the CRAFT text detector
Stars: ✭ 151 (+906.67%)
Mutual labels:  text
glfont
A modern opengl text rending library for Golang
Stars: ✭ 27 (+80%)
Mutual labels:  text
humanize time
Adds the humanize method to reports the approximate distance in time between two Time. humanize supports i18n translations too so it can be used in internationalized apps.
Stars: ✭ 20 (+33.33%)
Mutual labels:  i18n
ctxutil
utils for Go context
Stars: ✭ 18 (+20%)
Mutual labels:  context
gatsby-simple-blog
an easily configurable gatsby-starter-blog with overreacted looking and tags, breadcrumbs, disqus, i18n, eslint, algolia supported
Stars: ✭ 48 (+220%)
Mutual labels:  i18n
iwata-asks-downloader
Tool to download Iwata Asks interviews (none of which are stored in this repo)
Stars: ✭ 17 (+13.33%)
Mutual labels:  text
timber-ruby
🌲 Great Ruby logging made easy.
Stars: ✭ 155 (+933.33%)
Mutual labels:  context
vue-resize-text
A vue directive which automatically resize font size based on element width.
Stars: ✭ 65 (+333.33%)
Mutual labels:  text

react-text-translator

A typed way to translate react apps with context

Firstly, define your translator as follows

import {createTranslations} from 'react-text-translator';

export const translator = createTranslations({
	'Hello World': {
		SPANISH: 'Hola mundo',
		BRITISH: 'Hello World',
	},
	'Contact Us': {
		BRITISH: 'Contact Us',
		SPANISH: 'Contáctanos',
	},
});

export const Text = translator.Text;

Second, initialize your context and provide state for the active language

import {translator} from './translator';

function LangWrapper() {
	const [lang, setLang] = useState('BRITISH');

	return (
		<translator.TranslationProvider activeLang={lang}>
			<App />
		</translator.TranslationProvider>
	);
}

Then, you are able to use the <Text /> component as you would any other by passing a string as it's children (and only a string).

import {Text} from './translator';

export default function Child() {
  return (
    <div>
      <Text>Hello World</Text>
      <Text>Contact Us</Text>
    </div>
  );
}```
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].