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

@zauberware/weblate-create-components

v0.0.8

Published

You need `curl` to be installed. It is installed per default on each unix-like machine.

Downloads

3

Readme

Requirements

You need curl to be installed. It is installed per default on each unix-like machine.

Install

# ... as a dev dependency
npm i -D @zauberware/weblate-create-components
yarn add @zauberware/weblate-create-components -D
# ... as a global dependency
npm i -g @zauberware/weblate-create-components
yarn add @zauberware/weblate-create-components -g

Create Project on your weblate server

Create a new project at https://translations.zauberware.dev/. For the case you don't want everyone to access the translations you need to make the project private. Copy token and project name and your api token to your .env file. Go to personal profile to grap token and to project settings to grap project name.

.env

Configure and put these env variables to your .env file. IMPORTANT: If any of those is missing the whole process won't work!

REACT_APP_WEBLATE_TOKEN=token
REACT_APP_WEBLATE_PROJECT_ID=projectid
REACT_APP_WEBLATE_URL=https://translations.zauberware.dev
REACT_APP_WEBLATE_BRANCH=develop
REACT_APP_DEFAULT_LOCALE=de
REACT_APP_LOCALES=["de", "en"]
REACT_APP_WEBLATE_COMMIT_PENDING_AGE=<duration-in-hours>
[email protected]:zauberware/<project-name>.git
REACT_APP_LOCALES_FOLDER=public/locales
REACT_APP_GLOB_FILE_MASK=./public/locales/de/*.json
REACT_APP_LOCALES_FILE_TYPE=json

REACT_APP_WEBLATE_FILE_MASK=src/config/translations/*.json

Description

REACT_APP_WEBLATE_TOKEN:

The token of your weblate account or the specific weblate project. Can be found at Account API Settings

REACT_APP_WEBLATE_PROJECT_ID:

The slug you've added while creating the weblate project.

REACT_APP_WEBLATE_URL:

The host url of your weblate server. In our example: https://translations.zauberware.dev

REACT_APP_WEBLATE_BRANCH:

The Branch where Weblate will commit the changes to.

REACT_APP_DEFAULT_LOCALE:

The Branch where Weblate will commit the changes to.

REACT_APP_LOCALES:

Not used right now, but will add more languages in future releases.

REACT_APP_WEBLATE_COMMIT_PENDING_AGE:

The duration in hours after that weblate will create a commit of the pending changes.

REACT_APP_REPO_URL:

The Git Link of the connected repository where weblate will create the commit and read the translations from.

REACT_APP_LOCALES_FOLDER:

The folder where the translations are inside (without the trailing slash). For a React project normally: public/locales

REACT_APP_GLOB_FILE_MASK:

Glob pattern to match all files in the source langauge. For example: ./public/locales/de/*.json

REACT_APP_LOCALES_FILE_TYPE:

The ending of the locale files. For json files it's just json.

IMPORTANT:

Only required if only language files.

REACT_APP_WEBLATE_FILE_MASK:

If your translations file structure is not the default structure of i18next, you need to add the weblates file mask, where the '*'-character represents the different languages. Example: src/config/translations/*.json

package.json scripts

Put these scripts into your root package.json

# only necessary if you installed the package as dev dependency
"weblate-create-components": "npm explore @zauberware/weblate-create-components -- npm run create-components --env=$PWD"

Flows

With the following command you can generate all required components on your weblate project. Already existing components will be skipped by the weblate api.

# for local dev dependency
npm run weblate-create-components

If you installed weblate globally you can simply run the command:

# for global package
weblate-create-components -- npm run create-components --env=$PWD

S3 Bucket sync

tbd.