1.0.6 • Published 6 months ago

@uxland/react-services v1.0.6

Weekly downloads
-
License
BSD-4-Clause
Repository
github
Last release
6 months ago

UXL React Services npm version

Build StatusStatementsBranchesFunctionsLines
BuildStatusStatementsBranchesFunctionsLines

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})