New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dfds-contentful/translation

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfds-contentful/translation

translation scripts

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28
decreased by-58.82%
Maintainers
2
Weekly downloads
 
Created
Source

DFDS Translation System

This package facilitates working with translations in Contentful

Usage (Export)

  • exportTranslations --space-id=<spaceId> --environment-id=<environment-id> --management-token=<management-token> --url-filter=<url pattern> --locale=<locale> --mode=<mode> --exact-url The exportTranslations script is used for generating JSON from pages in Contentful (starting with a URL slug, and most commonly used on DotCom)

  • exportOneType --space-id=<spaceId> --environment-id=<environment-id> --management-token=management-token --type-id=<typeId> --team-id=<teamId> --locale=<locale> --mode=<mode> The exportOneType script is used for generating JSON from entries of a specific type. If team-id is specified, then only the entries with this team ID will be exported.

  • exportOneEntry --space-id=<spaceId> --environment-id=<environmentId> --management-token=management-token --entry-id=<entryId> --locale=<locale> --mode=<mode> The exportOneEntry script is used for generating JSON from ONE Contentful entry (and everything below it). This is typically used for special cases and exceptions.

Export script arguments:

ParameterDescription
url-filterThe URL under which we want the content exported (required in the exportTranslations script only)
exact-url (optional)if specified, only content for this exact URL gets exported, otherwise ALL pages matching the pattern will be exported (exportTranslations script only)
type-idThe id of the content type in Contentful whose entries we want exported (required for the exportOneType script)
team-id (optional)The ID of the TeamName entry in the ShortStrings space. If specified, only the entries with that teamID will be exported (exportOneType script)
entry-idThe Contentful id of the entry to export (required for the exportOneEntry script)
localelocale to export for. For example da-DK, tr-TR (case doesn't matter). Additional supported locale aliases are listed below:
all: all supported locales at DFDS
all-b2b: locales used in Freight & Logistics
all-pax: locales used in PAX
all-app: locales used by the App team
mode (optional)determines how the export gets generated, see options belowExpected format coming back from the translation vendor
"all English" is the default mode, generating English content for everything under the URL.translations for the English strings that were sent out
missing: export only the strings that have no translations for that language. The result is English strings to be translatedtranslations for the English strings that were sent out
existing: re-sends the strings that already have translations for them. This generates 2 files per language. The source English (for reference) and the existing translation for target languagecorrections to existing translations
space-idThe ID of the space in Contentful, usually pre-specified
environment-idThe environment for that contentful space, usually export goes from master
management-tokenThe access token for that Contentful space, usually pre-specified

Usage (Import)

The importTranslations script is used for importing translated JSON files into Contentful

The syntax for this script is as follows:

importTranslations --space-id=<spaceId> --environment-id=<environment-id> --management-token=management-token --filename=<filename_locale.json> [--overwrite] [--all-locales] [--all-folders]

Import script arguments:

ParameterDescription
filenameThe filename containing translations. Specify the filename relative to package/translation/translationImport. The suffix of the file indicates which locale the translations are for, for example myfile_da-DK.json will be imported into the Danish locale, and myfile_tr-TR.json will be imported into the Turkish locale
all-localesimport from files of all available locales. With this option, you should remove the <locale>.json postfix, leaving the name as --filename=myfile
all-foldersimport from files of subfolders, in all available locales. Note that the specified argument at --filename will be ignored, and all files in all subfolders of package/translation/translationImport will be imported
overwrite (optional)If false (default), any existing content in the locale being imported will be KEPT. If true, the content in the JSON file will supercede what's in Contentful
space-idThe ID of the space in Contentful, usually pre-specified
environment-idThe environment for the Contentful space into which we are importing, usually the import is into staging or sandbox for testing and verification, and master for going live
management-tokenThe access token for that Contentful space, usually pre-specified

Note: while you can export in different modes (all English / existing / missing), the importer doesn't have modes, everything we import is going to be either new translations or existing translations fixed up

Keywords

FAQs

Package last updated on 26 Mar 2024

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc