Skip to content

Commit

Permalink
Merge pull request #38 from gentoo90/fixes
Browse files Browse the repository at this point in the history
merge(loader):   default suffix and types
  • Loading branch information
rbalet authored Jan 13, 2025
2 parents 1120e5d + 993cb6d commit 5211814
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions projects/multi-http-loader/src/lib/multi-http-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export interface TranslationResource {
export class MultiTranslateHttpLoader implements TranslateLoader {
constructor(
private _handler: HttpBackend,
private _resourcesPrefix: string[] | TranslationResource[],
private _resourcesPrefix: (string | TranslationResource)[],
) {}

public getTranslation(lang: string): Observable<any> {
const requests: Observable<Object | {}>[] = this._resourcesPrefix.map((resource) => {
let path: string

if (typeof resource === 'string') path = `${resource}${lang}.json`
else path = `${resource.prefix}${lang}${resource.suffix || '.json'}`
else path = `${resource.prefix}${lang}${resource.suffix ?? '.json'}`

return new HttpClient(this._handler).get(path).pipe(
catchError((res) => {
Expand Down

0 comments on commit 5211814

Please sign in to comment.