def translate(x: str, d: dict) -> str:
    """
    Convert english digits to persian digits.
    :param x: string to translate
    :param d: dict for using on translate
    :return: translated string
    """
    if not isinstance(x, str):
        raise TypeError("x is not string")
    if not isinstance(d, dict):
        raise TypeError("d is not dict")

    trans = str.maketrans(d)
    return x.translate(trans)