How to set the Locale.current to be same as the Environment locale?

I have this code

As you can see, the locale of the Environment is different from the Locale given by .current. This is a problem for me because I have code that uses String(localized:) and AttributedString. I would like to be able to preview them with the locale I set in the Environment without any additional work on my part.

I assumed these Apis would use the locale set by the environment but no, it uses the locale as decided by the schema used to build the preview app. The current solution I have is to manually change the App Language in the Preview's scheme to be whatever I need to correctly localize the language in Preview.

Hi,

Sorry to hear you are having trouble viewing different locales while using previews. Unfortunately you have here found a situation where overriding the locale in the environment doesn't work for APIs that don't interact or read from the SwiftUI environment (Formatters is another common one folks are impacted by).

The only suggestion I have for now is to use the scheme picker's UI affordance to manually switch between locales/languages as opposed to just overriding the SwiftUI environment's Locale.

How to set the Locale.current to be same as the Environment locale?
 
 
Q