lookup (key)

This is the most common way to look up values from databags from regular Python code. Within templates you can also use the bag function which is easier to call.

The key is in dotted notation. For more information about this refer to the main databags documentation.


def translate(pad, alt, key):
    return pad.databags.lookup('i18n.%s.%s' % (alt, key), key)