0.0.1 • Published 5 years ago

curli-intl v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

curli-intl

Build Status Coverage Status

Typed internationalization (intl/i18n) library for TypeScript/JavaScript apps and Curli Framework.

Installation

Install by npm

npm install --save curli-intl

Basic Usage

1 - In the configurations file, declare de followings properties:

@SUPPORT_LANGUAGES: (Array) A list with the supported languages. @DEFAULT_LANGUAGE (string) The default language we will use if we aren't providing it in the get method.

2 - Add the module definer:

import {TranslationsModuleDefiner} from "curli-intl";

  app.addModules(new TranslationsModuleDefiner(app));

3 - Attach translation files paths to the service

public registerTranslations(translationsService: TranslationsService): void {
    translationsService.registerPath({path: 'languages/'});
}

4 - Get the translation

const name = this.container.get('translations').get('name');

Commands

  • npm run build: Build the project (Translations).
  • npm run build:clean: Delete first the dist folder and build it.
  • npm run clean: Delete the dist folder.
  • npm run test: Execute the tests.
  • npm run test:coverage: Execute the tests and calculate the coverage.
  • npm run lint: Check the code using the rules in .eslintre.js
  • npm run lint:fix: Check the code and try to fix it.

Contributing

When submitting your pull-request try to follow those guides:

License

MIT