All Projects → barisates → react-translator-component

barisates / react-translator-component

Licence: MIT License
React language translation module for developing a multilingual project.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

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

sketch-crowdin
Connect your Sketch and Crowdin projects together
Stars: ✭ 35 (+169.23%)
Mutual labels:  multilingual, internationalization, localization, translate
React Translated
A dead simple way to add complex translations (i18n) in a React (DOM/Native) project 🌎🌍🌏
Stars: ✭ 176 (+1253.85%)
Mutual labels:  internationalization, localization, react-component, translate
React Intl Hooks
React hooks for internationalization without the hassle ⚛️🌍
Stars: ✭ 64 (+392.31%)
Mutual labels:  internationalization, localization, translate
Fluent
Fluent — planning, spec and documentation
Stars: ✭ 818 (+6192.31%)
Mutual labels:  internationalization, localization, translate
translate-components
🌎🌍🌏 translate-components provides a super simple translation for React.
Stars: ✭ 16 (+23.08%)
Mutual labels:  multilingual, translate, react-translate
blazor-ui-messages
Localization messages for Telerik UI for Blazor components: https://www.telerik.com/blazor-ui
Stars: ✭ 24 (+84.62%)
Mutual labels:  multilingual, internationalization, localization
Texterify
The localization management system.
Stars: ✭ 37 (+184.62%)
Mutual labels:  internationalization, localization, translate
Flutter translate
Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
Stars: ✭ 245 (+1784.62%)
Mutual labels:  internationalization, localization, translate
Keys Translations Manager
KTM, a locale management web app built on MERN stack, lets you manage and control locales in one place. It's particularly useful for someone who needs to manage multiple internationalization/localization projects.
Stars: ✭ 81 (+523.08%)
Mutual labels:  multilingual, internationalization, localization
tr4n5l4te
Use Google Translate without an API key.
Stars: ✭ 32 (+146.15%)
Mutual labels:  translator, internationalization, translate
rosetta
A blazing fast internationalization (i18n) library for Crystal with compile-time key lookup.
Stars: ✭ 23 (+76.92%)
Mutual labels:  internationalization, localization
fluent-vue
Internationalization plugin for Vue.js
Stars: ✭ 137 (+953.85%)
Mutual labels:  internationalization, localization
cldr-engine
Internationalization and localization in Typescript with Unicode CLDR, batteries included
Stars: ✭ 34 (+161.54%)
Mutual labels:  internationalization, localization
lisan
🌈i18n, Reimagined! 🚀A blazing fast and super small i18n library for Javascript
Stars: ✭ 85 (+553.85%)
Mutual labels:  internationalization, localization
linguist
Linguist is a powerful browser extension for translate pages and text, which are ready to replace your favorite translate service
Stars: ✭ 21 (+61.54%)
Mutual labels:  translator, translate
flutter-internationalization
Flutter Internationalization by Using JSON Files
Stars: ✭ 18 (+38.46%)
Mutual labels:  internationalization, localization
plate
Internationalization library for Python
Stars: ✭ 31 (+138.46%)
Mutual labels:  internationalization, localization
Localizater
Laravel localization package for wrapping routes in multiple locale prefixes
Stars: ✭ 48 (+269.23%)
Mutual labels:  multilingual, localization
SimpleTranslationSystem
A simple C# translation system
Stars: ✭ 14 (+7.69%)
Mutual labels:  translator, translate
Localisation
Repository for translation and discussion for OpenRCT2.
Stars: ✭ 49 (+276.92%)
Mutual labels:  internationalization, localization

react-translator-component

React language translation module for developing a multilingual project.

npm package Build Status Dependencies Status Package Size

Getting started

Install with NPM:

$ npm install react-translator-component

Usage

Live Demo CodeSandbox

Quite simple to use;

  • Make your translator configuration.
  • Include text contents in the T(text) function.
  • Finally, call your application in <Translator> /* APP */ </Translator>.
// App.js
import React from 'react';
import { Translator, T, TF, LanguageList, Config } from 'react-translator-component'

Config.default = 'tr';
Config.list = {
  default: 'en',
  list: {
    en: {
      text: 'English',
      icon: require('./locale/flags/en.svg'),
      file: require('./locale/en.js')
    },
    tr: {
      text: 'Türkçe',
      icon: require('./locale/flags/tr.svg'),
      file: require('./locale/tr.js')
    }
  }
}

function App() {
  return (
    <div>
      <h1>
        {T("There are no facts, only interpretations.")}
      </h1>
      <h6>
        {TF("{0} {1}", "Friedrich", "Nietzsche")}
      </h6>
      <LanguageList />
    </div>
  )
}

function TranslatorApp() {
  return (
    <Translator>
      <App />
    </Translator>
  )
}

export default TranslatorApp;

Config

/* Default Language */
Config.default = 'tr';

/* Language List */
Config.list = {
  de: {
    // display text
    text: 'Deutsch',
    // display icon
    icon: require('./locale/flags/de.svg'),
    // translate file
    file: require('./locale/de')
  },
  en: {
    text: 'English',
    icon: require('./locale/flags/en.svg'),
    file: require('./locale/en')
  },
  tr: {
    text: 'Türkçe',
    icon: require('./locale/flags/tr.svg'),
    file: require('./locale/tr')
  }
}

Translate File

{key} The text you have written into the T(text) function. {translated_text} Related translation text.

module.exports = {
    '{text}': '{translated_text}'
}
Sample
// ./locale/en.js
module.exports = {
    'There are no facts, only interpretations.': 'There are no facts, only interpretations.'
}
// ./locale/tr.js
module.exports = {
    'There are no facts, only interpretations.': 'Doğrular ve yanlışlar yoktur, sadece yorumlar vardır.'
}

Translate Function

You can develop a multilingual application by typing the text as it is without using any key. Type the text content into the T(text) or TF(text, ...arg) function and update the translation files.

// simple usage
T("The text you want to translate.");

// usage with arguments like a string.format
TF("The {0} you want to translate with {1}.", "text", "arguments");

Texts that have not been added to the Translate file will be collected at the rtc-missing-keys in LocalStorage.

Language List

Use the <LanguageList /> component to change the language within your application.

Default Theme

Use with the default theme.

<LanguageList />

Default Theme

Dropdown Theme

Use with the dropdown theme.

<LanguageList Theme="Dropdown" />

Default Theme

Custom Language List
  • Define <LanguageList Language={this.state.language} /> in this way to create your own language list.
  • When {this.state.language} in changes, your application will be render in that language.

Author

Barış Ateş

Enes Zeren

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].