Lusito / web-ext-translator

An easy to use translation tool for web-extensions
zlib License
41 stars 9 forks source link

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?

Advanced features for your web-extension

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

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.