Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

PyBabel json gettext strings extractor

Project Description

Release notes

  • 0.2.0 - Added Python 3 support.
  • 0.1.0 - Initial release.

Installation

pip install pybabel-json

Usage

Add [json: path/**.json] to babel.cfg

Dependencies

  • Uses javascript lexer built in into babel, so no dependencies but babel itself

Key features:

  • Two JSON formats supported: plain string and custom gettext_string format
  • Keys are usually ignored, the only exception are objects with “type”:”gettext_string”
  • Keys are mainly used for logical separation of lists of values that should be translated
  • Lists also supported, both in plain strings and gettext_string format
{
    "simple_format_with_tree":{
        "inner":{
            "tree":{
                "key1":"Some key to translate",
                "key2":"Another key to translate",
                "key3":"Repeating key to translate",
                "key4":"Repeating key to translate"
            }
        }
    },
    "gettext_format_key1":{
        "type":"gettext_string",
        "funcname":"ngettext",
        "content":"Singular string",
        "alt_content":"Plural string"
    },
    "gettext_format_key2":{
        "type":"gettext_string",
        "funcname":"ngettext",
        "content":"Another singular string",
        "alt_content":"Another plural string"
    },
    "list_of_values":[
        "one",
        "two",
        "three"
    ],
    "list_of_gettexts":[
        {
            "type" : "gettext_string",
            "funcname" : "ngettext",
            "content" : "list_string 1",
            "alt_content" : "plural list_string1"
        },
        {
            "type" : "gettext_string",
            "funcname" : "ngettext",
            "content" : "list_string 2",
            "alt_content" : "plural list_string2"
        }
    ]
}
Release History

Release History

This version
History Node

0.2.0

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PyBabel-json-0.2.0.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 Source Mar 11, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting