Package translate :: Package storage :: Module jsonl10n :: Class JsonFile
[hide private]
[frames] | no frames]

Class JsonFile

source code


A JSON file

Nested Classes [hide private]
  UnitClass
The class of units that will be instantiated and used by this class
Instance Methods [hide private]
 
__init__(self, inputfile=None, unitclass=<class 'translate.storage.jsonl10n.JsonUnit'>, filter=None)
construct a JSON file, optionally reading in from inputfile.
source code
 
__str__(self)
Converts to a string representation that can be parsed back using parsestring().
source code
 
_extract_translatables(self, data, stop=None, prev='', name_node=None, name_last_node=None, last_node=None)
Recursive function to extract items from the data files
source code
 
parse(self, input)
parse the given file or file source string
source code

Inherited from base.TranslationStore: __getstate__, __setstate__, add_unit_to_index, addsourceunit, addunit, detect_encoding, findid, findunit, findunits, getids, getprojectstyle, getsourcelanguage, gettargetlanguage, getunits, isempty, makeindex, remove_unit_from_index, require_index, save, savefile, setprojectstyle, setsourcelanguage, settargetlanguage, translate, unit_iter

Inherited from base.TranslationStore (private): _assignname

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from base.TranslationStore: parsefile, parsestring

Class Variables [hide private]

Inherited from base.TranslationStore: Extensions, Mimetypes, Name, sourcelanguage, suggestions_in_format, targetlanguage

Inherited from base.TranslationStore (private): _binary

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, inputfile=None, unitclass=<class 'translate.storage.jsonl10n.JsonUnit'>, filter=None)
(Constructor)

source code 

construct a JSON file, optionally reading in from inputfile.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Converts to a string representation that can be parsed back using parsestring().

Overrides: object.__str__
(inherited documentation)

_extract_translatables(self, data, stop=None, prev='', name_node=None, name_last_node=None, last_node=None)

source code 

Recursive function to extract items from the data files

data - is the current branch to walk down stop - is a list of leaves to extract or None to extract everything prev - is the heirchy of the tree at this iteration last - is the name of the last node last_node - the last list or dict

parse(self, input)

source code 

parse the given file or file source string

Overrides: base.TranslationStore.parse