<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/LocalizedStringResource",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation23LocalizedStringResourceV"
  },
  "title" : "LocalizedStringResource"
}
-->

# LocalizedStringResource

A reference to a localizable string, accessible from another process.

```
struct LocalizedStringResource
```

## Overview

Use [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource) to provide localizable strings with lookups you defer to a later time.

When you create a localized string or a localized attributed string with an initializer that takes <doc://com.apple.documentation/documentation/Swift/String/LocalizationValue>, those initializers lookup the localized string immediately. If you want to perform the lookup at a later time, use this [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource) type to refer to the localizable strings. Then, when you need to perform localization, create a <doc://com.apple.documentation/documentation/Swift/String> or [`AttributedString`](/documentation/Foundation/AttributedString) from an initializer that takes a [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource) parameter, such as:

- <doc://com.apple.documentation/documentation/Swift/String>: <doc://com.apple.documentation/documentation/Swift/String/init(localized:)> or <doc://com.apple.documentation/documentation/Swift/String/init(localized:options:)>.
- [`AttributedString`](/documentation/Foundation/AttributedString): [`init(localized:)`](/documentation/Foundation/AttributedString/init(localized:)), [`init(localized:including:)`](/documentation/Foundation/AttributedString/init(localized:including:)-2xebo), or [`init(localized:including:)`](/documentation/Foundation/AttributedString/init(localized:including:)-15xc5).

This approach allows you to provide localizable strings to an entirely separate process, which may use a different locale. For example, consider an app with a data model type called `UserAction` that uses [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource) rather than strings for its `title` and `description` properties.

```swift
public protocol UserAction {
    static var title: LocalizedStringResource { get }
    static var description: LocalizedStringResource { get }
}
```

This app (or one of its embedded frameworks) then uses these [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource) members to defer looking up localized strings. Typically, this happens when calling out to another process over XPC.

```swift
public func perform(action: UserAction) {
    ...
    // Send text to another process via XPC or similar.
    performActionOutOfProcess(title: action.title, description: action.description)
}
```

Then, when the other process receives the call, it can alter the [`locale`](/documentation/Foundation/LocalizedStringResource/locale) in the [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource), prior to resolving the localized strings.

```swift
func performActionOutOfProcess(title: LocalizedStringResource,
                               description: LocalizedStringResource) {
    // Set resource locales to match the current locale
    // of the separate process.
    var fixedTitle = title
    fixedTitle.locale = .current
    var fixedDescription = description
    fixedDescription.locale = .current
    
    // Look up localized strings.
    let titleString = String(localized: fixedTitle)
    let descriptionString = String(localized: fixedDescription)
        
    // Use a correctly localized title/description.
}
```

The <doc://com.apple.documentation/documentation/AppIntents> framework uses [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource) to perform a late resolution of localized strings. This allows the Siri UI to potentially use different localization preferences than the app providing the intent.

## Topics

### Creating a localized string resource

### Creating a localized string resource from literal values

[`init(stringLiteral:)`](/documentation/Foundation/LocalizedStringResource/init(stringLiteral:))

Creates a localized string resource from the specified string literal.

[`init(stringInterpolation:)`](/documentation/Foundation/LocalizedStringResource/init(stringInterpolation:))

Creates a localized string resource from the given string interpolation.

### Accessing resource properties

[`key`](/documentation/Foundation/LocalizedStringResource/key)

The key to use to look up a localized string.

[`defaultValue`](/documentation/Foundation/LocalizedStringResource/defaultValue)

The resource’s default value.

[`table`](/documentation/Foundation/LocalizedStringResource/table)

The name of the table containing the key-value pairs.

[`bundle`](/documentation/Foundation/LocalizedStringResource/bundle)

The bundle containing the table’s strings file.

[`LocalizedStringResource.BundleDescription`](/documentation/Foundation/LocalizedStringResource/BundleDescription)

The location of a bundle to use for looking up localized strings, such as the main bundle, or a bundle at a specific file URL.

[`locale`](/documentation/Foundation/LocalizedStringResource/locale)

The locale to use to look up the localized string from the string resource.

### Describing a resource

[`localizedStringResource`](/documentation/Foundation/LocalizedStringResource/localizedStringResource)

A resource that helps provide a description of the instance.



---

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)