Skip to content

Lang Class

A custom dict class which supports comments.

Extends

  • dict

Properties

comments

A list of all comments.

Methods

format

Parameters

NameTypeDescription
sstrThe key to translate
subsList of values to substitute. These can either be ordered (%1, %2, etc.) or not ordered (%s)

translate

Parameters

NameTypeDefaultDescription
keystrThe key to translate
subsList of values to substitute. These can either be ordered (%1, %2, etc.) or not ordered (%s)
fallbackstrNoneThe fallback text if key can't be found. Returns key by default.

insert_comment

Inserts a comment to the file at a specified line before the key/value if any.

Parameters

NameTypeDescription
lineintThe line to insert at.
sstrThe content of the comment.

remove_comment

Removes a comment at the specified index.

Parameters

NameTypeDescription
lineintThe comment to remove.

clear_comments

Removes all comments from this file.

Not associated with or approved by Mojang Studios or Microsoft