stuck on the exercise "Pig Latin" in python

Hello! I spent several hours on the exercise “Pig Latin” in python, and all the solutions I proposed do not work. Please, I need help. Here is my code:

def translate(text: str) -> str:
    def translate_word(word):
        vowels = {'a', 'e', 'i', 'o', 'u'}
        
        if word[0] in vowels or word[:2] == 'xr' or word[:2] == 'yt':
            return word + 'ay'
        if word[:2] == 'qu':
            return word[2:] + 'quay'
        else:
            i = 0
            while i < len(word) and word[i] not in vowels:
                if word[i:i+2] == 'qu':
                    i += 2
                    break
                i += 1
            if word[i-1:i+1] == 'qu':
                i += 1
            return word[i:] + word[:i] + 'ay'
    
    words = text.split()
    translated_words = [translate_word(word.lower()) for word in words]
    return ' '.join(translated_words)

Which tests fail? What is the test output?

Here are the test results

Please always use text (in a codeblock) to share text. Text is easier to read. And copy from.

​​1. Do you understand what the test is doing?
2. Do you understand what the test is expecting and why?
3. Do you understand what your code returns and how it differs?
4. Do you understand why your code is returning what it returns?