@uxland/react-services
v1.0.6
Published
Browser Utilities
Downloads
191
Readme
UXL React Services
| Build Status | Statements | Branches | Functions | Lines | | ----------------------------------------------- | --------------------------------------------- | ----------------------------------------- | ------------------------------------------- | ----------------------------------- | | | | | | |
Installation
npm i @uxland/react-services
Usage
Get Hook
getHook('hookName', {foo: 'bar'});
Notification Service
const service = new NotificationService();
service.notify('foo', {position: 'bottom-right'});
service.notifyError('foo', {position: 'bottom-right'});
I18N
Setup i18n
setupI18n({foo: 'bar'}, 'es', '-');
Translation Service
const service = new TranslationService();
service.translate('foo');
Add locale bundle
addLocaleBundle("ca", "ns", {foo: {bar: "dummy"}});
Global path hook
const globalPath = useGlobalPath();
globalPath("ns.foo.bar") // => dummy
Locale path hook
const localePath = useLocalePath("ns");
localePath("foo.bar") // => dummy
Translate
translate('ns', 'foo.bar', {dummy: 0})