Skip to content

Commit

Permalink
fix: useStaticFilesLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
nglazov committed Nov 20, 2015
1 parent 66c3a1b commit 30940be
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/translate.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class TranslateStaticLoader implements TranslateLoader {
private http: Http;
private sfLoaderParams = {prefix: 'i18n', suffix: '.json'};

constructor(http: Http) {
constructor(http: Http, prefix: string, suffix: string) {
this.configure(prefix, suffix);
this.http = http;
}

Expand All @@ -23,8 +24,8 @@ class TranslateStaticLoader implements TranslateLoader {
* @param suffix
*/
public configure(prefix: string, suffix: string) {
this.sfLoaderParams.prefix = prefix;
this.sfLoaderParams.suffix = suffix;
this.sfLoaderParams.prefix = prefix ? prefix : this.sfLoaderParams.prefix;
this.sfLoaderParams.suffix = suffix ? suffix : this.sfLoaderParams.suffix;
}

/**
Expand Down Expand Up @@ -71,8 +72,8 @@ export class TranslateService {
/**
* Use a static files loader
*/
public useStaticFilesLoader() {
this.currentLoader = new TranslateStaticLoader(this.http);
public useStaticFilesLoader(prefix?: string, suffix?: string) {
this.currentLoader = new TranslateStaticLoader(this.http, prefix, suffix);
}

/**
Expand Down

0 comments on commit 30940be

Please sign in to comment.