Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

localize-router-http-loader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localize-router-http-loader

A loader for localize-router that loads config using Http

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

localize-router-http-loader

Build Status npm version

A loader for localize-router that loads config using Http

This package is built for angular version <4.3

Installation

npm install --save localize-router-http-loader

Usage

In order to load localize-router config via http, you must initialize LocalizeRouterModule with LocalizeRouterHttpLoader:

// Required for AoT
export function HttpLoaderFactory(translate: TranslateService, location: Location, settings: LocalizeRouterSettings, http: Http) {
  return new LocalizeRouterHttpLoader(translate, location, settings, http);
}

LocalizeRouterModule.forRoot(routes, {
    parser: {
        provide: LocalizeParser,
        useFactory: HttpLoaderFactory,
        deps: [TranslateService, Location, LocalizeRouterSettings, Http]
    }
})

Parameters

LocalizeRouterHttpLoader has one optional parameter path which points to json config file. Default value is assets/locales.json.

export function HttpLoaderFactory(translate: TranslateService, location: Location, settings: LocalizeRouterSettings, http: Http) {
  return new LocalizeRouterHttpLoader(translate, location, settings, http, 'my/custom/url/to/file.json');
}

Config file

JSON config file has following structure:

{
    "locales": ["en", "de", ...],
    "prefix": "MY_PREFIX"
}
interface ILocalizeRouterParserConfig {
    locales: Array<string>;
    prefix?: string;
}

Prefix field is not mandatory and default value is empty string.

License

Licensed under MIT

Keywords

FAQs

Package last updated on 24 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc