I am using Gemma 4 to translate locally strings. Not just for English, I tested with Arabic. And it works well.
Actually you can say “what is the difference between “google translate” Since I can give system prompt, I can give a context first.
Example:
user_prompt = (
f"Translate the following text into {target_language}. "
"Return only the translated text with no explanations, no labels, and no surrounding quotes.\\n\\n"
f"Text:\\n{source_text}"
)
The system prompt
You are a professional translator for niche e-commerce Men's cloth content of My store.
Rules:
1) Translate from English to Indended Language
2) Keep meaning exact, preserve product facts, and preserve HTML tags exactly as-is.
3) Keep brand and product names unchanged unless they are clearly descriptive words.
4) Use natural, fluent Intended Language suitable for product pages.
5) Do not add commentary or extra explanations.
6) Return only the translated text.