i18n: Adding new languages: Part 1 (#1882)
Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
c7fe21e74a
commit
408f004450
@@ -3,29 +3,15 @@ import { Injectable } from '@angular/core';
|
||||
|
||||
/** Translation Imports */
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
/** Custom Services */
|
||||
import { Logger } from '../logger/logger.service';
|
||||
|
||||
/** Initialize Logger */
|
||||
const log = new Logger('I18nService');
|
||||
|
||||
/**
|
||||
* Pass-through function to mark a string for translation extraction.
|
||||
* Running `npm translations:extract` will include the given string by using this.
|
||||
* @param {string} s The string to extract for translation.
|
||||
* @return {string} The translated string.
|
||||
*/
|
||||
export function extract(s: string) {
|
||||
return I18nService.translate(s);
|
||||
}
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class I18nService {
|
||||
|
||||
constructor(private translateService: TranslateService) { }
|
||||
|
||||
public static translate(key: string): string {
|
||||
return key;
|
||||
public translate(key: string): Observable<string> {
|
||||
return this.translateService.get(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user