0.8.1 • Published 4 years ago

ter-localization v0.8.1

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

ThreeEyedRaven's localization library

UI Editor

Motivation

One of the most painful problem that we repeatedly face when making application is localization (aka internationalization, i18n, multiple language, etc ...). There's a lot of library support localization in react-js, react-native, node-js, but the most painful thing was not how to implement the localization, but how to co-operate with client or 3rd-party team to make the translate. Thousand of text must be gathered, versioned, translated, updated in daily or even hourly basis.

TER-Localization, with new approach method, provide a solution which can speed up everything, include:

  • Easy start without any configuration
  • Collect the translate text from source code
  • Collect the translate text run-time (even for dynamic text, like error return from server)
  • Translate by UI, providable to customer / 3rd-party translate team
  • Sync with google spreadsheet

User manual

GuidePath
01How to use GDrive SyncGDrive Sync

Installation

Install with npm or yarn

yarn add ter-localization
yarn global add ter-localization-cli

Start to get the UI

ter-localization-cli serve

UI Editor

Most of information is default. You can just click the button and go.

Config inside the code

Write the translation centralization file, usually inside the ${storage_path} folder

import en from './en';
import jp from './jp';
import { TranslateService } from 'ter-localization';

TranslateService.setConfig(require('./config'));
TranslateService.setTranslate({
  en,
  jp,
});

TranslateService.setLanguage('en');

export default TranslateService;

In side your component

import './localization/index'; // one time import in very top class is okie. no need to import this in every file
import {translateWrapper} from 'ter-localization';

render() {
  const { t } = this.props;

  return (
    <Text>
      {t('some_key')}
    </Text>
  );
}

export default translateWrapper('your_group')(App);

Or using with LocalizationComponent Extends

import {LocalizationComponent} from 'ter-localization';

class AddModal extends LocalizationComponent {
  translationGroup = 'your_group';
  
  componentDidMount() {
    super.componentDidMount(); // remember this line, REMEMBER!!!
    
    // Other code in componentDidMount
  }
}

Or you can use standalone code

import { TranslateService } from 'ter-localization';

// use it

TranslationService.t('group')('key');

Then run your application. The new translation will be automatically added to all the translation file

Global function

Install global

yarn global add ter-localization
CommandDescription
serveStart server to listen and edit localization

Serve

TER-Localization start a server to listen to new word added and provide UI edit for translation

The UI will be provided with information in the config file. Default will be http://localhost:5050

Params

ParamsShortDescriptionDefault
--config-cPath to config file./src/localization/config.json
0.8.1

4 years ago

0.8.0

4 years ago

0.7.5

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.1

5 years ago

0.4.0

5 years ago

0.3.24

5 years ago

0.3.23

5 years ago

0.3.22

5 years ago

0.3.21

5 years ago

0.3.19

5 years ago

0.3.18

5 years ago

0.3.17

5 years ago

0.3.16

5 years ago

0.3.15

5 years ago

0.3.14

5 years ago

0.3.13

5 years ago

0.3.12

5 years ago

0.3.11

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.22

6 years ago

0.2.21

6 years ago

0.2.20

6 years ago

0.2.19

6 years ago

0.2.18

6 years ago

0.2.17

6 years ago

0.2.16

6 years ago

0.2.15

6 years ago

0.2.14

6 years ago

0.2.13

6 years ago

0.2.12

6 years ago

0.2.11

6 years ago

0.2.10

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago