ngx- 翻译- 摘录- 标记
这是伟大的图书馆的叉子 金·比斯比尔格但就我所知 原本的图书馆不幸不再开发
安装
$ npm install @colsen1991/ngx-translate-extract-marker
重要通知
Kim的ngx-translate-extract包中不支持标记管和指令.
请使用 文杜尔的 相反: $ npm install @colsen1991/ngx-translate-extract。 。 。 .
使用标记函数标记提取的字符串
如果出于某种原因,你想提取没有直接传递给 ngx-translate/TranslateService是因为 get(), (中文(简体) ), instant() 或者说 stream() 方法,您可以在自定义标记函数中将其包扎,以便允许 ngx-translate-extract 知道你想取出他们.
导入并使用标记函数 :
import { marker } from '@colsen1991/ngx-translate-extract-marker';
marker('Extract me');
或者你可以别名 marker() 方法 :
import { marker as _ } from '@colsen1991/ngx-translate-extract-marker';
_('Extract me');
然后运行摘录脚本: $ ngx-translate-extract
使用标记管标记提取的字符串
如果出于某种原因,你想提取没有直接传递给 ngx-translate/TranslatePipe你可以把它们传到自定义的标记管上 ngx-translate-extract 知道你想取出他们.
导入和使用您的标记管 @NgModule数字 :
import { MarkerPipe } from '@colsen1991/ngx-translate-extract-marker/extras';
@NgModule({ declarations: [MarkerPipe] })
export class YourModule {}
或使用独立部件中的独立管(注意不要使用这两种方法:
import { MarkerPipeStandalone } from '@colsen1991/ngx-translate-extract-marker/extras';
@Component({ imports: [MarkerPipeStandalone], standalone: true })
export class StandaloneComponent {}
然后在模板中标记字符串 :
<your-component [yourInput]="'Hello world' | marker"></your-component>
使用标记指令标记提取的字符串
如果出于某种原因,你想提取没有直接传递给 ngx-translate/TranslateDirective,您可以将其包装在一个自定义标记指令中,以便允许 ngx-translate-extract 知道你想取出他们.
导入并使用您的标记指令 @NgModule数字 :
import { MarkerDirective } from '@colsen1991/ngx-translate-extract-marker/extras';
@NgModule({ declarations: [MarkerDirective] })
export class YourModule {}
或者在您的独立组件中使用独立指令( O)注意不要使用这两种方法:
import { MarkerDirectiveStandalone } from '@colsen1991/ngx-translate-extract-marker/extras';
@NgModule({ imports: [MarkerDirectiveStandalone], standalone: true })
export class StandaloneComponent {}
然后在模板中标记字符串 :
<p marker>Hello World</p>
然后运行摘录脚本: $ ngx-translate-extract
ngx- 翻译- 摘录- 标记模块
也可以导入标记管和指令作为模块:
import { MarkerModule } from '@colsen1991/ngx-translate-extract-marker/extras';
@NgModule({ imports: [MarkerModule] })
export class YourModule {}
ngx- 翻译- 摘录
见 ngx- 翻译- 摘录 财务报告和审定财务报表 ngx-翻译 更多细节.
贷项
原始库、想法和代码: @biesbjerg/ngx-翻译-摘录-标记 ❤️