---
title: "init(localized:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/string/init(localized:)"
---

# init(localized:)

Creates a localized string from a localized string resource.

## Declaration

```swift
init(localized resource: LocalizedStringResource)
```

## Parameters

- `resource`: A LocalizedStringResource that provides the localization key, table, bundle, and locale.

## Discussion

Discussion Call this initializer to look up the localization that resource indicates from a string catalog or strings file in your app bundle. 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 creates the LocalizedStringResource. // Assume the string catalog contains "Hello, world!" for English // and "Bonjour, le monde!" for French. var localizable = LocalizedStringResource("Hello, world!") // Potentially using localizable in another process… localizable.locale = Locale(identifier: "en") let enLocalized = String(localized: localizable) localizable.locale = Locale(identifier: "fr") let frLocalized = String(localized: localizable) // enLocalized == "Hello, world!" // frLocalized == "Bonjour, le monde!" If you don’t need the deferred-loading behavior of LocalizedStringResource, use init(localized:table:bundle:locale:comment:) instead. If you prefer to use an arbitrary localization key rather than the localized string in the development language, use init(localized:defaultValue:table:bundle:locale:comment:).

## See Also

### Creating a Localized String

- [init(localized:table:bundle:locale:comment:)](swift/string/init(localized:table:bundle:locale:comment:).md)
- [init(localized:options:table:bundle:locale:comment:)](swift/string/init(localized:options:table:bundle:locale:comment:).md)
- [String.LocalizationValue](swift/string/localizationvalue.md)
- [String.LocalizationOptions](swift/string/localizationoptions.md)
- [init(localized:defaultValue:table:bundle:locale:comment:)](swift/string/init(localized:defaultvalue:table:bundle:locale:comment:).md)
- [init(localized:defaultValue:options:table:bundle:locale:comment:)](swift/string/init(localized:defaultvalue:options:table:bundle:locale:comment:).md)
- [init(localized:options:)](swift/string/init(localized:options:).md)
