Skip to main content

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"
        }
    ]
}

Metadata

Release files for PyBabel-json 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyBabel-json 0.2.0
File Size Uploaded
PyBabel-json-0.2.0.tar.gz 3.7 kB Details

Release files / PyBabel-json-0.2.0.tar.gz

Download URL PyBabel-json-0.2.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
204e7fdab0e39946b6793d5584e6927035d12f5813dc6efea24d580e2aa64ea9
BLAKE2b-256 checksum
How to use checksums
b0592268402b68316b7bb855ebae016b58cf303342f71c819420bebc9ff53d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page