@colsen1991/ngx-translate-extract-marker

中文文档
3.0.1发布于 2024/11/08MITTypeScriptES Module近 30 天下载 5.4万

使用 ngx- translate- extract 提取的手动标记字符串的函数、 管道和指令

中文使用文档
文档目录8 节
  1. 安装
  2. 重要通知
  3. 使用标记函数标记提取的字符串
  4. 使用标记管标记提取的字符串
  5. 使用标记指令标记提取的字符串
  6. ngx- 翻译- 摘录- 标记模块
  7. ngx- 翻译- 摘录
  8. 贷项

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-翻译-摘录-标记 ❤️

版本与发布记录

@colsen1991/ngx-translate-extract-marker 共发布 11 个版本,首次发布于 2023/01/17;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.0.1latest2024/11/082 年前
3.0.02024/11/082 年前
2.0.82023/03/143 年前
2.0.72023/01/273 年前
2.0.62023/01/263 年前
2.0.52023/01/193 年前

关于 @colsen1991/ngx-translate-extract-marker 的常见问题

@colsen1991/ngx-translate-extract-marker 是什么?

使用 ngx- translate- extract 提取的手动标记字符串的函数、 管道和指令

如何安装 @colsen1991/ngx-translate-extract-marker?

在项目目录运行 npm install @colsen1991/ngx-translate-extract-marker,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/common(>=14.2.0)、@angular/core(>=14.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@colsen1991/ngx-translate-extract-marker 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@colsen1991/ngx-translate-extract-marker 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@colsen1991/ngx-translate-extract-marker 可以商用吗?

@colsen1991/ngx-translate-extract-marker 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@colsen1991/ngx-translate-extract-marker 的下载量有多少?

根据 npm 官方下载统计,@colsen1991/ngx-translate-extract-marker 在 2026/10/11 – 2026/11/09 这 30 天内被下载 54,121 次,日均约 1,804 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@colsen1991/ngx-translate-extract-marker 还在维护吗?

最新版本 3.0.1 发布于 2024/11/08(2 年前);至今共发布 11 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/01/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。