App-level Language Setting (iOS)

Firework iOS SDK supports an in-app language setting that is independent of the system language. After you switch the language, SDK UI (video feed, story block, player, live stream, etc.) will be rendered in the selected language, and right-to-left (RTL) layout is automatically applied for RTL languages such as Arabic.

Swift integration

import FireworkVideo

// You should pass language code to this API, such as "en", "ar", "pt-BR" and "hu" etc.
// For the language codes we support, please refer to "Language support table" below.
FWSAppLanguageManager.shared.changeAppLanguage("ar")

The selected language is persisted by the SDK automatically, so it will be restored the next time the app is launched.

Please refer to the Language support table to learn the languages we supported.

circle-info

Generally, the changeAppLanguage API should be called in the following cases:

  1. The App is launched (e.g. in the application(_:didFinishLaunchingWithOptions:) method of your AppDelegate, or in the initializer of your SwiftUI App).

  2. Users change the app language manually.

  3. Other cases that change app language.

Reset to system language

Pass nil (or an empty string) to fall back to the system language and clear the cached value:

FWSAppLanguageManager.shared.changeAppLanguage(nil)

Read the current app language

appLanguage is a read-only property that reflects the current SDK language. It is nil when the SDK is following the system language.

Listen for language changes

The SDK posts a notification whenever the app language changes. You can observe it to refresh your own UI:

After changing the language

SDK components that are already on screen will not pick up the new language automatically. After calling changeAppLanguage, you should recreate any active SDK components, such as FWSVideoFeedView / FWSVideoFeedSwiftUIView, FWSStoryBlockView / FWSStoryBlockSwiftUIView, PlayerDeckView / PlayerDeckSwiftUIView, CircleStoryView / CircleStorySwiftUIView, etc., so they re-render with the new language and RTL layout.

You can use the AppLanguageChanged notification as the trigger to perform this from a single place.

circle-info

The SDK automatically dismisses the full-screen player and stops the floating player when the app language changes, so you don't need to handle them yourself.

Project setup: add localizations to your iOS project

iOS only loads localized resources for languages that your app's project declares as supported. As depicted in the screenshot below, you must add every language you want the Firework SDK to display in to your Xcode project's Localizations list — otherwise iOS will fall back to the development language for that language code.

Language support table

Language
Language code

English

en

Arabic

ar

Arabic (Saudi Arabia)

ar-SA

Arabic (United Arab Emirates)

ar-AE

German

de

Italian

it

Japanese

ja

Polish

pl

Portuguese (Brazil)

pt-BR

Russian

ru

Spanish

es

Spanish (Mexico)

es-MX

Spanish (Colombia)

es-CO

Vietnamese

vi

Thailand

th

Hungarian

hu

Turkish

tr

French

fr

Portuguese

pt

Indonesian

id

Swedish

sv

Romanian

ro

Traditional Chinese (Taiwan)

zh-TW

Traditional Chinese

zh-Hant

circle-info

For consistency with our Android SDK, you can pass zh-TW to changeAppLanguage; the iOS SDK maps it internally to zh-Hant-TW.

Last updated

Was this helpful?