Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度4-内部化-选择语言_Angular - Fatal编程技术网

Angular 角度4-内部化-选择语言

Angular 角度4-内部化-选择语言,angular,Angular,我使用angular i18n在我的web中使用多种语言 现在,我的网站有两种语言:西班牙语和英语 使用以下命令,多语言工作正常: ng serve 默认情况下为英语。将显示:搜索条件 ng serve --aot --locale es --i18n-format xlf --i18n-file src/i18n/messages.es.xlf --missing-translation error 或 它以西班牙语启动应用程序。将显示:Busqueda标准 但是现在,我需要从我的网站上

我使用angular i18n在我的web中使用多种语言

现在,我的网站有两种语言:西班牙语和英语

使用以下命令,多语言工作正常:

ng serve 
默认情况下为英语。将显示:搜索条件

ng serve --aot --locale es --i18n-format xlf --i18n-file src/i18n/messages.es.xlf --missing-translation error

它以西班牙语启动应用程序。将显示:Busqueda标准

但是现在,我需要从我的网站上选择语言

<div class="text-right divLang"><a href="">Español</a> | <a href="">English</a></div>
文件内容messages.es.xlf的示例:

<trans-unit id="main_searchTitle" datatype="html">
<source>Search Criteria</source>
<target>Criterios de Busqueda</target>
<context-group purpose="location">
  <context context-type="sourcefile">C:/develop/angular/multi/multi.component.ts</context>
  <context context-type="linenumber">3</context>
</context-group>
</trans-unit>

搜索条件
布斯奎达标准
C:/develope/angular/multi/multi.component.ts
3.
我没有使用systemsjs,我使用的是webpack


怎么做?

我正在修改此网站,我认为解决方案就在这里。我不使用文件:i18n.provider.ts,我将进行搜索。我可以从我的网站中选择语言吗?未使用的文件i18n.provider.ts?使用命令,不必拥有此文件。我正在修改此网站,我认为解决方案就在这里。我不使用文件:i18n.provider.ts,我将按照搜索。我可以从我的网站中选择语言吗?未使用的文件i18n.provider.ts?使用命令,不需要使用此文件。
messages.es.xlf
<trans-unit id="main_searchTitle" datatype="html">
<source>Search Criteria</source>
<target>Criterios de Busqueda</target>
<context-group purpose="location">
  <context context-type="sourcefile">C:/develop/angular/multi/multi.component.ts</context>
  <context context-type="linenumber">3</context>
</context-group>
</trans-unit>