Why do you believe so? I don’t think the create_user_profile
method is meant to be run manually, is run by Discourse after a user is created discourse/app/models/user.rb at main · discourse/discourse · GitHub
That is why you get the duplicate key value
error, because you are trying to create user profiles that already exist.
I tried to replicate this error by creating a user account with username دعم_المجتمع and I also tested it with an account with an English username, both had the interface language set to Arabic, and it works fine.
I don’t think this issue is related to the language or templates anymore, but to the badges missing images, as you pointed out here Badge image missing issue