tigrawap / pybabel-json

JSON gettext/i18n strings extractor for babel (pybabel)
MIT License
3 stars 3 forks source link

PyBabel-JSON

Release notes

Installation

pip install pybabel-json

Usage

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

Dependencies

Key features:

.. code-block:: json

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