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

ember-cli-zanata

v0.1.1

Published

Work with translations on Zanata.

Downloads

4

Readme

ember-cli-zanata

An addon to work with the Zanata API.

This is built to work together with ember-l10n.

Installation

ember install ember-cli-zanata

Enter your API data in the generated config/zanata.js file.

Usage

This addons provides a few commands to use:

  • ember zanata:push: Push your updated to Zanata
  • ember zanata:pull: Pull a given version from Zanata
  • ember zanata:version-create: Create a new version for a project
  • ember zanata:version-info: List information for a given version of a project
  • ember zanata:version-stats: List translation stats for a given version of a project
  • ember zanata:project-info: List basic information (like latest version) for a project
  • ember zanata:project-list: List all projects from Zanata

For all of these commands, you can run help to see all available parameters, e.g. ember help zanata:push.

Commands

push

Pull translation data from Zanata. This can pull translation files, source files, or both. Don't forget to specify a version & project to pull from!

You'll also need to specify the list of locales to pull. It is recommended to put those (along with the project-id) in the config/zanata.js file.

  • Push all files: ember zanata:push
  • Push translation files only: ember zanata:push --update-type=trans
  • Push source files only: ember zanata:push --update-type=source

Note that the Zanata API is a bit flaky. Because of this, this will try to push a few times - by default, 4 times. Only if it fails 4 times, will it error out.

pull

Pull translation data from Zanata. This can pull translation files, source files, or both. Don't forget to specify a version & project to pull from!

You'll also need to specify the list of locales to pull. It is recommended to put those (along with the project-id) in the config/zanata.js file.

  • Pull translation files only: ember zanata:pull
  • Pull all files: ember zanata:pull --update-type=both
  • Pull source files only: ember zanata:pull --update-type=source

version-create

Create a new version for a project.

ember zanata:version-create --version="XXX"

By default, it will push all files (sources & translations!) after successfully creating a new version. You can deactivate that behaviour like this:

ember zanata:version-create --version="XXX" --update-if-new=false

Additionally, if the version you are trying to create already exists, it will throw an error. You can supress that with:

ember zanata:version-create --version="XXX" -resolve-if-exists=true

This will then just print out a message that the version already exists, but exit with a success code.

version-stats

Show translation stats for a version of a project.

ember zanata:version-stats --version="XXX"

Will print something like this:

Translation progress for version 1.0.10 of project my-project (document messages): 81.65%
en: 100.00% (1064/1064) of phrases translated
zh-Hans: 98.03% (1043/1064) of phrases translated
zh-Hant: 98.03% (1043/1064) of phrases translated
de: 30.55% (325/1064) of phrases translated

version-info

Show information for a version of a project.

This is mainly the available locales.

ember zanata:version-info --version="XXX"

Will print something like this:

Version 1.0.10 for project my-project was successfully loaded
It has the following locales:
en: English
zh-Hans: Chinese (Simplified)
zh-Hant: Chinese (Traditional)
de: German

project-info

Display information for a given project.

ember zanata:project-info --project-id="XXX"

Will output something like:

Project my-project was successfully loaded
Project name: My Project
Latest version: 1.0.10

project-list

Display a list of all active projects available.

ember zanata:project-list

Will output something like:

2 active projects were found:
My Project (my-project)
Other Project (other-project)

Handling versions

Instead of specifying an actual version, you can also provide current, which will use the version from the package.json file.

Handling special locales

Sometimes, you might have locales that are called differently on Zanata than in your app. For example, in Zanata you might have zh-Hans, whereas it might be called zh_CN in your app.

For this, you can provide a special function in your Zanata config:

// config/zanata.js
module.exports = function() {
  return {
    // other config
    getZanataLocaleFunction(locale) {
      // From your app to Zanata, e.g. zh_CN --> zh-Hans
      return locale;
    },
    parseZanataLocaleFunction(locale) {
      // From Zanata to your app, e.g. zh-Hans --> zh_CN
      return locale;
    }
  };
};

License

This project is licensed under the MIT License.