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-pseudolocalize

v0.0.3

Published

A tiny addon that helps test your localization.

Downloads

2

Readme

Build Status Code Climate dependencies

Ember-pseudolocalize

Ember-pseudolocalize is a tiny addon that helps you ensure that your app is fully localized. Designed to work with ember-i18n.

Installation

Ember-pseudolocalize should work with any verion of Ember 2.x (tested with 2.8 and beyond), and ember-i18n 5.x. Install with:

ember install ember-pseudolocalize

Pseudolocaliwhat now?

Pseudolocalization is the process of replacing characters in a string with accented versions, but in a way that it's still legible. Śōmȇŧĥĩňĝ ĺĩƙȇ ŧĥĩś, so that you can easily identify untranslated strings. It's often used in conjunction with techniques that lengthen strings to help spot UI/UX issues (non-English strings are often more than 30% longer).

Displaying pseudolocalized strings

Simply switch your locale to to en-XA. There's a variety of browser addons available for Firefox and Chrome. Note that they usually change your Accept-Language header, so if your language detection relies on navigator.language or similar, you'll need to manually change the language of your browser.

Customization

Customize how the strings are pseudolocalized by editing your ember-cli-build and including an object at ember-pseudolocalize (see examples below). Customization options are passed directly to pseudoloc. Some of the relevant options are listed below.

Prepend, Append

Specifies the strings that should surround the pseudolocalized strings. The prepended and appended strings help to locate strings that have been cut off or improperly concatenated together - localized strings should use tokens for data since different languages have different word orders.

Default is [!! and !!].

// ember-cli-build.js
var app = new EmberApp({
  'ember-pseudolocalized': {
    prepend: '!~~',
    append: '~~!',
  }
});

// 'string with {{ token }}' -> '[## śťřīņğ ŵıţħ {{ token }}!!]'

StartDelimiter, EndDelimiter

Ember-i18n allows you to customize the way that tokens are interpolated in strings. By default ember-pseudolocalize supports double-stache ({{ foo }}) notation. If you're using something else (including triple stache notation), you will need to manually edit the start and end delimiter.

// ember-cli-build.js
// For "triple-stache" notation
var app = new EmberApp({
  'ember-pseudolocalized': {
    startDelimiter: '{{{',
    endDelimiter: '}}}',
  }
});

Extend

Extends the width of the string by the specified percentage. Useful if you will be localizing into languages such as German which can be 30% longer than English.

Default is 0.

// ember-cli-build.js
var app = new EmberApp({
  'ember-pseudolocalized': {
    extend: '0.3', // 30%
  }
});

// 'string with {{ token }}' ->
//'[!!ŝťŕĩʼnğ ŵĩťħ {{ token}}.        !!]'

Removing from your production payload

While ember-pseudolocalize is a small library, you might still want to remove it from your production payload using Ember CLI's addon blacklist feature.

var environment = process.env.EMBER_ENV;
var pluginsToBlacklist = environment === 'production' ? ['ember-pseudolocalize'] : [];

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    addons: {
      blacklist: pluginsToBlacklist
    }
  };
}