gobbledygook

0.0.3 • Public • Published

A tool for debugging of translations

Build Status

This project contains a node.js implementation of "fake translation", which makes it easier to debug the internationalization of software.

This project was inspired by the Translate Toolkit.

Usage

npm install gobbledygook
$ node
> require('gobbledygook')('Hello World!');
'¡pʅɹoM oʅʅǝH'

What's it do?

This library can algorithmically "translate" your software. The translation can be visually scanned to ensure that all user facing strings are properly substituted with translations.

Our fake translation is a right-to-left, inverted representation of english. It uses several unicode characters which resemble 180 degree rotated versions of their counterparts, and make it look like all the strings are upside down and backwards - you can still read it, but is is very clear what text is properly translated and what is not (suggesting an i18n bug).

Concretely, we test a couple different things at once here:

  1. rendering of R-T-L languages
  2. string extraction / string markup
  3. the substitution system and its ability to allow translators to reposition things (like move the privacy policy before the terms and we still sub links right)

Some details

This implementation supports basic HTML markup, HTML entities, and substitution markers.

Because we directly use very simple html in strings we expose to translators, this thing has to understand very basic html. Here's a concrete example:

  • real - Please close this window, <a %s>enable cookies and try again
  • fake - uıaƃa ʎɹʇ pua <a %s>sǝıʞooɔ ǝʅqauǝ ´ʍopuıʍ sıɥʇ ǝsoʅɔ ǝsaǝʅԀ

notice that the text within the full sentence must be inverted, however HTML tags must not be.

This implementation handles substitution markers such as %s and %(name) in translatable strings as placeholders where dynamically generated content (links, email addresses, website names, etc) will be placed. Needless to say, if %(cookieLink) is translated to )ʞuı⅂ǝıʞooɔ(%, substitution will be broken. This implementation respects these types of markers, and is currently hardcoded to only this style of substitution marker, but could be generalized.

The license

http://wtfpl.org

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    2
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i gobbledygook

Weekly Downloads

2

Version

0.0.3

License

none

Last publish

Collaborators

  • lloyd