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

storyblok-translate-slugs

v0.0.1

Published

npx CLI tool to automatically translate slug and name of stories of a Storyblok space using DeepL API.

Downloads

62

Readme

DeepL-translation of slugs/names for Storyblok stories

npm version license

An npx CLI tool to automatically translate the story-slugs and -names of a Storyblok CMS space using the DeepL API.

Requirements

  • A Storyblok space with the Translatable slugs app installed (requires at least Entry plan).
  • A DeepL API account (Free or Pro).

Installation


# simply auto-download and run via npx
$ npx storyblok-translate-slugs

# or install globally
$ npm install -g storyblok-translate-slugs

# or install for project using npm
$ npm install storyblok-translate-slugs

# or install for project using yarn
$ yarn add storyblok-translate-slugs

# or install for project using pnpm
$ pnpm add storyblok-translate-slugs

Usage

Call npx storyblok-translate-slugs with the following options:

Options

--token <token>                (required) Personal OAuth access token created
                                in the account settings of a Stoyblok user.
                                (NOT the Access Token of a Space!)
                                Alternatively, you can set the STORYBLOK_OAUTH_TOKEN environment variable.
--space <space_id>             (required) ID of the space to backup
                                Alternatively, you can set the STORYBLOK_SPACE_ID environment variable.
--deepl-api-key <key>          (required) DeepL API Key
                                Alternatively, you can set the DEEPL_API_KEY environment variable.
--region <region>              Region of the space. Possible values are:
                                - 'eu' (default): EU
                                - 'us': US
                                - 'ap': Australia
                                - 'ca': Canada
                                - 'cn': China
                                Alternatively, you can set the STORYBLOK_REGION environment variable.
--source-lang <source-lang>    Source locale to translate from (=default Storyblok locale).
                                Defaults uses DeepL auto-detection.
--content-types <types>        Comma seperated list of content/component types to process. Defaults to 'page'.
--skip-stories <stories>       Comma seperated list of the full-slugs of stories to skip.
                                (e.g. --skip-stories "home,about-us")
--only-stories <stories>       Comma seperated list of the full-slugs of stories you want to limit processing to.
                                (e.g. --only-stories "about-us")
--locales <locales>            Comma seperated languages to process. Leave empty for all languages.
                                (e.g. --locales "de,fr")
--force                        Creates new slug, even if slug-field already has content. Defaults to false.
--publish                      Publish stories after updating. Defaults to false.
--dry-run                      Only display the changes instead of performing them. Defaults to false.
--verbose                      Show detailed output for every processed story.
--help                         Show this help

Storyblok OAuth token, space-id and region as well as the DeepL API Key can be set via environment variables. You can also use a .env file in your project root for this (see .env.example).

Minimal example

npx storyblok-translate-slugs --token 1234567890abcdef --space 12345 --deepl-api-key 1234567890abcdef

Maximal example

npx storyblok-translate-slugs \
    --token 1234567890abcdef \
    --deepl-api-key 1234567890abcdef \
    --region us \
    --source-lang en \
    --content-types "page,news-article" \
    --skip-stories "home" \
    --locales "de,fr" \
    --force \
    --publish \
    --dry-run \
    --verbose

License

This package is open-sourced software licensed under the MIT license.