tx2manifest

Overview

tx2manifest is a utility to help in i18n of FirefoxOS apps which adhere to the design pattern described in this article. Translations are created by volunteers and fellow developers on the Transifex collaborative translation website, and pushed/pull to/from the site using a command-line utility called tx. Once the translations files are brought back to the project, they need to be merged with the project main manifest.webapp file. This is what this tools does.

The goals of the project are modest: implement something useful to me as a FirefoxOS developer while exploring node.js, Promises and q-io (which are amazing tools by the way).

Installation

As root, type

npm install -g tx2manifest

Usage

In the root directory of your app, type:

tx2manifest -h # To get usage

Injects transifex translated manifest.properties into manifest.webapp and writes the result to stdout

        --help, -h
                Prints this help message

        --rootdir, -d
                Root directory of the webapp (defaults to .)
                (example: --rootdir=/home/users/js/myapp)

        --slug, -s
                Regexp which matches the .tx/config section name corresponding to the manifest_properties resource (defaults to manifest_properties)
                (example: --slug=myapp.manifest_properties)

        --locale, -l
                Name of the main locale (defaults to en)
                (example: --locale=fr)

tx2manifest    # To run the command if the default options suit you

The command does not modify any files, it simply prints the updated manifest to the console. The following sample manifest shows highlighted in yellow the areas of the manifest.webapp file which are updated by tx2manifest.

{ version: '1.0.8',
  name: 'Dictaphone',
  description: 'A digital dictaphone application for the web in general and FirefoxOS in particular',
  developer: { name: 'Lukas Laag', url: 'http://www.vectomatic.org' },
  launch_path: '/index.html',
  appcache_path: '/index.appcache',
  installs_allowed_from: [ '*' ],
  icons: 
   { '30': '/img/icons/icon-30.png',
     '32': '/img/icons/icon-32.png',
     '60': '/img/icons/icon-60.png',
     '90': '/img/icons/icon-90.png',
     '120': '/img/icons/icon-120.png',
     '128': '/img/icons/icon-128.png',
     '256': '/img/icons/icon-256.png' },
  default_locale: 'en',
  locales: 
   { de: 
      { name: 'Diktaphon',
        description: 'Ein digitales Diktaphon für das Web im Allgemeinen und Firefox OS im Speziellen.' },
     es: 
      { name: 'Dictáfono',
        description: 'Una aplicación de grabación de voz digital para la web en general y FirefoxOS en particular' },
     fr: 
      { name: 'Dictaphone',
        description: 'Une application de dictaphone digital pour le web en général et FirefoxOS en particulier' },
     zh_CN: 
      { name: 'Dictaphone',
        description: '一款适用于所有Web平台,特别是Firefox OS平台的数字录音应用' },
     zh_TW: 
      { name: 'Dictaphone',
        description: '一套供 Firefox OS 與其他網頁平台使用的數位錄音軟體' } },
  permissions: 
   { 'audio-capture': { description: 'Capture input from the microphone to create sound clips' },
     storage: { description: 'Store sound clips in IndexedDB without size limitations' },
     'device-storage:music': 
      { access: 'readcreate',
        description: 'Export recorded clips as .WAV files to the device music storage' } },
  type: 'privileged' }

Here are the main related URL of interest for this project:

URL Description
https://www.npmjs.org/package/tx2manifest npmjs repository
https://github.com/laaglu/tx2manifest github repository
https://github.com/laaglu/tx2manifest/issues Bug tracker