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

web-ext-translator

v4.3.0

Published

An easy to use translation tool for web-extensions

Downloads

12

Readme

License

An easy to use translation tool for web-extensions with markdown preview. It's mostly written in TypeScript, HTML & CSS using React and BEM. It is both an online web-app as well as a standalone tool using Electron as a container.

You can check out the online version here: https://lusito.github.io/web-ext-translator/

Screenshot

Why?

  • It is quite painful to manage i18n messages.json files for web-extensions manually.
  • Comparing two languages side-by-side makes it easier to spot missing translations
  • Being able to edit multi-line translations with a markdown preview was one of the major goals.
    • The markdown preview even replaces placeholders with their respective example.
  • It allows users of the online editor to easily load translations from a ZIP file or a Github repository (even branches).
  • After changes have been done, translations can be exported to a ZIP file.
  • There's even a standalone, desktop application (see further below) you can install via npm!

Advanced features for your web-extension

  • WET adds hashes to all messages.json files, except the default locale in order to show which translations have been changed (by a red border on the right side of the editor).
  • WET helps reduce git changes and thus merge conflicts:
    • It automatically formats your messages.json into a homogeneous format (see below for formatting options).
    • The order of the translations in the messages.json is kept.
  • You can define groups inside of your messages.json to keep translations organized.
  • You can apply changes to your extensions live from the online editor using wet-layer

Working with groups

In your messages.json, you can add a group entry like this:

"__WET_GROUP__": { "message": "Branding" },

This will insert a group header in the translations editor. You can place multiple groups in your messages.json. It is valid JSON to use the same key multiple times in an object, so adding __WET_GROUP__ as key is no problem. If you, however, want to use unique keys, using __WET_GROUP__ as a prefix works as well.

Check out this example if you want to see groups in action.

Working with comments

JSON files in web-extensions conform to the JSON standard with one exception: single line comments are allowed!

WET uses this fact, so that you can write comments instead, so the above example simply becomes:

// Branding

  • Any comment you write before a message will be shown the same way as a group in the editor and later written back as comment.
  • Comments within the message objects themselves will be ignored and not written back during export!

Customizing the formatter

WET enforces a json format style upon you, since it would be difficult to keep the original formatting. The default formatter writes messages on multiple lines with indentation:

"extensionName": {
    "message": "My extension name",
    "description": "Extension name as shown on the add-ons listing page.",
    "hash": "8138b17e7f1daceffca0d19015bb86e7"
},

However, if you prefer to have each message on a single line like this:

"extensionName": { "message": "My extension name", "description": "Extension name as shown on the add-ons listing page.", "hash": "8138b17e7f1daceffca0d19015bb86e7" },

You can do so by adding this message to your default locales messages.json file:

"__WET_FORMATTER__": { "message": "single_line" },

This setting will be re-exported only on the default locale.

Standalone Desktop Application

npm install -g web-ext-translator

From the root of your web-extension directory (where your _locales directory is located), run wet

Report isssues

Something not working quite as expected? Do you need a feature that has not been implemented yet? Check the issue tracker and add a new one if your problem is not already listed. Please try to provide a detailed description of your problem, including the steps to reproduce it.

Contribute

Awesome! If you would like to contribute with a new feature or submit a bugfix, fork this repo and send a pull request. Please, make sure all the unit tests are passing before submitting and add new ones in case you introduced new features.

License

Web-Ext-Translator has been released under the zlib/libpng license, meaning you can use it free of charge, without strings attached in commercial and non-commercial projects. Credits are appreciated but not mandatory.