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

@tegonal/qwik-speak-deepl

v1.0.4

Published

Qwik Speak Deepl Translator

Downloads

5

Readme

A translator for qwik-speak language files using the DeepL API (free/pro)

Features

  • Translate qwik-speak extracted JSON files using the DeepL API
  • Detects source and target languages automatically based on qwikSpeakInline() vite plugin configuration
  • Matches the source/target language to the DeepL API language codes as good as possible and tells you if there is no match available
  • Preserves dynamic placeholders like {{name}} and {{count}} without relying on preserveFormatting
  • Caches each translated string in a local file to avoid unnecessary API calls
  • Backups previous translations before writing the new string set
  • Shows differences between the previous and the new string set
  • Supports DeepL context by using the content of a text file and all aggregated source language strings

Installation

npm add -D @tegonal/qwik-speak-deepl
yarn add -D @tegonal/qwik-speak-deepl

Usage

Run the translator with the following command from the root of your qwik project:

# Runs with default options. This will determine the default language
# from your vite config and translate the source files to all available languages.
npx qwik-speak-deepl -a <deeplApiKey>

A word on context

Single word strings are notoriously difficult to translate correctly without context.

For better translation quality, you can create a text file that is used to provide context for the translator in the root of your qwik project named qwik-speak-deepl.context.txt (or any other name, see command arguments). The contents of this file will be sent alongside each translation request. Additionally, all strings of the source language are added to context as well for good measure, to provide DeepL with the best possible starting point to find translations for single word strings.

The context file could contain a general summary of the kind of app you are building or its functionality. You can try different approaches and see what works best for you. For e-commerce, it could contain a list of brand or product names.

Options

Usage: qwik-speak-deepl <command> [options]

Options:
  -a, --apiKey <key>        DeepL API key
  -c, --contextFile <path>  A text file with context for better quality translations (default:
                            "qwik-speak-deepl.context.txt")
  -nc, --noCache            Don't use the existing cache (default: false)
  -f, --formality <level>    Formality level to use. Available options are 'less' or 'more' (default:
                            "less")
  -h, --help                display help for command

Example call:
  $ qwik-speak-deepl --help