npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dfds-contentful/translation

v2.0.1

Published

translation scripts

Downloads

1,974

Readme

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:

| Parameter | Description | | | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | --- | | url-filter | The 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-id | The 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-id | The Contentful id of the entry to export (required for the exportOneEntry script) | | | locale | locale 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 below | Expected 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 translated | translations 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 language | corrections to existing translations | | | space-id | The ID of the space in Contentful, usually pre-specified | | | environment-id | The environment for that contentful space, usually export goes from master | | | management-token | The 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:

| Parameter | Description | | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | filename | The 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-locales | import from files of all available locales. With this option, you should remove the <locale>.json postfix, leaving the name as --filename=myfile | | all-folders | import 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-id | The ID of the space in Contentful, usually pre-specified | | environment-id | The 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-token | The 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