Skip to content

frontojs/localize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fronto Localize

Basic Localization utility

// /path/to/component_name/locale.js
import localize from 'fronto-localize';

const en = {
  blah: "Blah"
};

const th = {
  blah: "บลา"
}

export default localize({ en, th });

Then in your component file.

// /path/to/component_name/index.js
import t from './locale'

class ComponentName extends React.PureComponent { 
  // ...
  render() {
    <div>{t('blah')}</div>
  }
}

By default it will look for the localStorage.getItem('locale') if that doesn't exist it defaults to en, however you can specify one like so t('blah', 'th')

About

Localization module for react apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published