<!--
{
  "documentType" : "article",
  "framework" : "Xcode",
  "identifier" : "/documentation/Xcode/previewing-localizations",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Previewing localizations"
}
-->

# Previewing localizations

Test localizations in the SwiftUI preview or the Interface Builder preview.

## Overview

You can preview localizations early in development while you lay out your app’s interface
for both SwiftUI and Interface Builder apps. For SwiftUI apps, you need to add the
language or import the localization before you preview it, described in [Adding support for languages and regions](/documentation/Xcode/adding-support-for-languages-and-regions)
and [Importing localizations](/documentation/Xcode/importing-localizations). For Interface Builder apps, you can first preview
the interface in pseudolanguages and then later in the localizations you add.

### Add localizations to a SwiftUI preview

For SwiftUI apps, you can preview a localization by setting the <doc://com.apple.documentation/documentation/SwiftUI/EnvironmentValues/locale>
environment variable in your code. Use the <doc://com.apple.documentation/documentation/SwiftUI/View/environment(_:_:)>
function to set the locale for all views in the view hierarchy of a SwiftUI preview.
For example, if you add German to your project, you can set the locale to German
(`de`):

```swift
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
                .environment(\.locale, .init(identifier: "de"))
    }
}
```

To preview right-to-left languages, also set the <doc://com.apple.documentation/documentation/SwiftUI/EnvironmentValues/layoutDirection>
key to <doc://com.apple.documentation/documentation/SwiftUI/LayoutDirection/rightToLeft>.

To preview multiple localizations, add additional previews to your code and set the
<doc://com.apple.documentation/documentation/SwiftUI/EnvironmentValues/locale> environment
value for each. The localizations appear in the SwiftUI preview.

![Screenshot of the project editor with the ContentView.swift file selected in the navigator and the line of code that sets the locale highlighted, and its preview on the right.](images/com.apple.Xcode/previewing-localizations-1@2x.png)

### Preview localizations in Interface Builder

For Interface Builder, you can preview localizations any time during development
by choosing localizations including pseudolanguages in the preview. You don’t need
to build and run your app to see the preview.

In Interface Builder, select the desired view controller. Click the Adjust Editor
Options button in the upper-right corner, then choose Preview. A preview of the layout
appears to the right of the canvas.

In the preview area, select a preview or click in the background to deselect all
previews. If you don’t select a preview, you’ll change the language of all previews.
Click the language button—for example, English—in the lower-right corner. In the
pop-up menu that appears, choose a localization or pseudolanguage.

![Screenshot of Interface Builder showing previews of a view controller scene and the location of the language pop-up menu in the lower-right corner.](images/com.apple.Xcode/previewing-localizations-2@2x.png)

## See Also

[Adding support for languages and regions](/documentation/Xcode/adding-support-for-languages-and-regions)

Select the resources that you want to localize for each language and region you support.

[Importing localizations](/documentation/Xcode/importing-localizations)

Import the files that you translate or adapt for a language and region into your
project.

  <doc://com.apple.documentation/documentation/SwiftUI/EnvironmentValues>



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)