2.0.1 • Published 1 month ago

@dfds-contentful/translation v2.0.1

Weekly downloads
312
License
MIT
Repository
github
Last release
1 month ago

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

2.0.1

1 month ago

1.1.33

3 years ago

1.1.32

3 years ago

1.1.31

3 years ago

1.1.30

3 years ago

1.1.29

3 years ago

1.1.28

3 years ago

1.1.27

3 years ago

1.1.26

3 years ago

1.1.25

3 years ago

1.1.24

3 years ago

1.1.23

3 years ago

1.1.22

3 years ago

1.1.21

3 years ago

1.1.16

3 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.20

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.12

3 years ago

1.1.13

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.30.6

3 years ago

1.1.3

3 years ago

1.30.5

3 years ago

1.30.4

3 years ago

1.30.5-alpha.179

3 years ago

1.30.4-alpha.1

3 years ago

1.30.3

3 years ago