---
title: "init(localized:including:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/attributedstring/init(localized:including:)-15xc5"
---

# init(localized:including:)

Creates a localized attributed string from a localized string resource, including an attribute scope that a key path identifies.

## Declaration

```swift
init<S>(localized resource: LocalizedStringResource, including scope: KeyPath<AttributeScopes, S.Type>) where S : AttributeScope
```

## Parameters

- `resource`: A doc://com.apple.foundation/documentation/Foundation/LocalizedStringResource that provides the localization key, table, bundle, and locale.
- `scope`: An doc://com.apple.foundation/documentation/Foundation/AttributeScopes key path that identifies an attribute scope to associate with the attributed string.

## Discussion

Discussion Call this initializer to look up the localization indicated by resource. Alter the resource’s locale prior to calling this method if you want to localize this string in a different locale than the process that created the LocalizedStringResource. The attributed string contains attributes of type AttributeScopes.FoundationAttributes.LocalizedStringArgumentAttributes to indicate runs containing formatted text, such as localized numbers or dates. Access these attributes with the attribute key localizedNumericArgument or localizedDateArgument.

## See Also

### Creating a Localized Attributed String

- [init(localized:options:table:bundle:locale:comment:)](foundation/attributedstring/init(localized:options:table:bundle:locale:comment:)-8dlnl.md)
- [init(localized:options:table:bundle:locale:comment:including:)](foundation/attributedstring/init(localized:options:table:bundle:locale:comment:including:)-8uknv.md)
- [init(localized:options:table:bundle:locale:comment:including:)](foundation/attributedstring/init(localized:options:table:bundle:locale:comment:including:)-5jzpg.md)
- [String.LocalizationValue](swift/string/localizationvalue.md)
- [AttributedString.FormattingOptions](foundation/attributedstring/formattingoptions.md)
- [init(localized:)](foundation/attributedstring/init(localized:).md)
- [init(localized:including:)](foundation/attributedstring/init(localized:including:)-2xebo.md)
- [LocalizedStringResource](foundation/localizedstringresource.md)
