Socket
Book a DemoInstallSign in
Socket

@siemens/element-translate-ng

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@siemens/element-translate-ng

Element translation abstraction layer.

48.0.1
main
latest
Source
npmnpm
Version published
Weekly downloads
5.7K
57.19%
Maintainers
5
Weekly downloads
 
Created
Source

Element Translate

element-translate-ng is a translation abstraction layer. It can be used with

  • ngx-translate
  • Angular localize
  • Other frameworks in the future

See here for details how it works and how to use it.

Usage

Install the library as follows:

npm install --save @siemens/element-translate-ng

An important part of the library is the extraction of translatable keys as a TypeScript interface as well as extracting a JSON messages file with default translations. The extraction happens on compiled files. I.e. make sure to run the build first. Then, to run these extractions

npx update-translatable-keys

By default, this will pick of the configuration from a file element-translate.conf.json. To use a different config file, pass as the only argument to the command.

The config file looks like this

{
  "files": "dist/@simpl/**/fesm2022/**/*.mjs",
  "configs": [
    {
      "name": "element",
      "locationPrefix": "projects/element-ng",
      "keysFile": "projects/element-ng/translate/si-translatable-keys.interface.ts",
      "keysInterfaceName": "SiTranslatableKeys",
      "messagesFile": "dist/@siemens/element-ng/template-i18n.json"
    }
  ]
}
  • files is a glob pattern for defining the files to scan
  • configs is an array of configs. For mono-repos building multiple libraries, they can be separated into different configs. All keys are required:
    • name is a unique name
    • locationsPrefix defines the path prefix of the source files, important to distinguish between different libraries in a mono-repo
    • keysFile defines the path of the generated TypeScript interfaces file
    • keysInterfaceName defines the name of the TypeScript interface
    • messagesFile defines the path of the generated messages JSON file

Testing

Run npm run translate:test to perform the unit tests via Karma. You can set a seed for running the tests in a specific using an environment variable: SEED=71384 npm run translate:test

License

The following applies for code and documentation of the git repository, unless explicitly mentioned.

Copyright (c) Siemens 2016 - 2025

MIT, see LICENSE.md.

FAQs

Package last updated on 05 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.