Templatetagish wrapper for Translator.trans()

    :param parser:
    :param token:
    :param is_transchoice:
    :return:

def tranz(parser, token, is_transchoice=False):
    """
    Templatetagish wrapper for Translator.trans()

    :param parser:
    :param token:
    :param is_transchoice:
    :return:
    """
    tokens = token.split_contents()
    id = tokens[1]
    number = domain = locale = None
    parameters = {}
    if len(tokens) > 2:
        skip_idx = None
        for idx, token in enumerate(tokens[2:], start=2):
            if idx == skip_idx:
                skip_idx = None
                continue

            if "=" in token:
                k, v = token[0:token.index('=')], token[token.index('=') + 1:]
                parameters[k] = v
            elif token == "number":
                number = tokens[idx + 1]
                skip_idx = idx + 1
            elif token == "from":
                domain = tokens[idx + 1]
                skip_idx = idx + 1
            elif token == "into":
                locale = tokens[idx + 1]
                skip_idx = idx + 1
            else:
                raise TemplateSyntaxError(
                    "Unexpected token {0} in tag tranz".format(token))
    if is_transchoice and number is None:
        raise TemplateSyntaxError(
            "number parameter expected in tag {tag_name}")

    return TranzNode(
        id,
        parameters,
        domain,
        locale,
        number,
        is_transchoice=is_transchoice)