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

@shermant/i18n-translator

v1.2.1

Published

![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/ShermanTsang/i18n-translator?label=version) ![Build Status](https://github.com/ShermanTsang/i18n-translator/actions/workflows/npm-publish.yml/badge.svg) ![npm](https://img.shields.io/npm/d

Downloads

142

Readme

i18n-translator

GitHub tag (latest by date) Build Status npm

I initially created this translation tool for one of my other projects to reduce the time spent translating i18n files.

While developing this project, I aimed to make it user-friendly and versatile for general i18n use cases.

If this tool helps you, it would be my pleasure.

Feature

  • 🤖 Utilize AI services for translation
  • 👁️ Monitor file changes for automatic re-execution
  • 🙌 Run alongside your project with ease

Task

🔎 Extract

Extract i18n files from the specified path and save them to the designated output directory.

📚 Translate

Translate i18n files using AI services and save the results to the specified output directory.

Configuration

Options

| task | name | description | |-----------|----------|--------------------------------------------------------------------------------------------------| | common | tasks | The tasks you want to execute.Any task can be run individually. | | extract | pattern | Accepts RegExp or string.Must include %key% to indicate a variable. | | extract | dirs | The target directories for the operation. | | extract | exts | Only executes on files with the specified extensions.Do not include the . in the extension. | | common | output | The directory where output files will be saved. | | translate | langs | The languages you wish to support in your project. | | translate | provider | The AI service provider. | | translate | key | The API token required to access the AI service. | | common | watch | Enables file monitoring for continuous execution.Pass any value to enable watching mode. |

Source

You can configure the tool using three different methods, with the settings being read and merged in the following order:

  1. .env file
  2. Command line parameters
  3. Inquirer prompts

For more details, refer to the src/workflow.ts file.

1. .env file

You can specify options in your project’s .env file using the TRANSLATION_ prefix.

For example:

TRANSLATOR_PATTERN=^(?i)test
TRANSLATOR_TASKS=extract1,translate
TRANSLATOR_DIRS=./test
TRANSLATOR_TEST=111
TRANSLATOR_KEY=sk-5805c22222228aad2d5386e877fa

Ensure that all options are in UPPERCASE and SNAKE_CASE.

2. command line parameters

When running the project from the command line, you can use --option to set configurations.

npx @shermant/i18n-translator --pattern=tttt --exts vue js --watch

Note: Command line settings will override those in the .env file.

3. inquirer

Based on the selected tasks, the program will check which options need to be set before execution.

If any options are missing, the program will prompt you to input them through an inquirer flow.

Provider

As of 2024-09-02, the project supports deepseek as the AI service provider.

In the future, I plan to integrate LangChain to support a variety of AI service providers.

Usage

npx @shermant/i18n-translator
bunx @shermant/i18n-translator

This version is more polished and clearer, ensuring proper grammar and consistent formatting.