TranslateLoader}from'@ngx-translate/core';import{TranslateHttpLoader}from'@ngx-translate/http-loader';// 创建TranslateHttpLoader,需要HttpClientexportfunctioncreateTranslateLoader(http: HttpClient) {returnnewTranslateHttpLoader(http,'./i18n/','.json');...
在src/assets/i18n/下 // zh-cn.json{"UI":{"title":"示例","greeting":"你好 {{name}}","description":"中文"}} // en.json{"UI":{"title":"DEMO","greeting":"hello {{name}}","description":"en"}} 参考 https://www.npmjs.com/package/@ngx-translate/core ...
export function createTranslateHttpLoader(http: Http) { return new TranslateHttpLoader(http, './assets/i18n/', '.json');//也可以如此写:return new TranslateHttpLoader(http);,这样写就是默认在assets目录下有i18n目录,并且语言文件是以.json结尾的。 } @NgModule({ declarations: [ AppComponent ], i...
对多语言支持的需求变得至关重要。NGX-Translate 是一个功能强大的 i18n(国际化)库,可简化将 Angular...
3.组件部分(i18n.component.ts) import { Component, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core' @Component({ moduleId: module.id, selector: 'my-app', templateUrl: 'i18n.component.html' }) ...
@ ngx-translate / core Angular的国际化(i18n)库。 使用ngx-translate的简单示例: ://stackblitz.com/github/ngx-translate/example 在此处获取完整的变更日志: : 目录 安装 首先,您需要安装npm模块: npm install @ngx-translate/core --save 选择与您的Angular版本相对应的版本: 角度的 @ ngx-translate / cor...
ngx-translate/core @ngx-translate/core The internationalization (i18n) library for Angular. Simple example using ngx-translate:https://stackblitz.com/github/ngx-translate/example Get the complete changelog here:https://github.com/ngx-translate/core/releases...
4138⭐ 336🍴 i18n-ally) - All in one i18n extension for VS Code. 132⭐ 43🍴 ngx-translate-router) - Translate routes using ngx-translate. 18⭐ 6🍴 intl-tel-input-ng) - An Angular component to easily integrate 7775⭐ 1955🍴 intl-tel-input). 9⭐ 0🍴 ng-intl) - Type...
translate/http-loader'; import { HttpClient } from '@angular/common/http'; export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } @NgModule({ declarations: [ // 你的组件 ], imports: [ TranslateModule....
为了在我的编辑器中使用 Angular,我用 Angular 编写了一个重命名功能。而为了使用它,我得再次使用一次...