Text Manager (v5)
Use the Apps panel iOS/Android/SDK SDK to manage your app texts in one place, with multilingual support.
The iOS Apps Panel SDK provides a Text Management module, letting you update the texts in your app without having to resubmit it to the stores. It supports multiple languages, and you can add variables to your strings.
Integration
At every launch, your app downloads the latest version of texts. That means if you want to change text in your app, you don't have to release a new version of your app.
You can specify a default language like so:
TextManager.shared.setLocale(Local.current, default: Locale(identifier: "fr_FR"))
At the first launch of your application, the texts won't be downloaded yet, so you need to embed a JSON file containing the keys and values in your app.
You can get this file in your back office, on the page where you set your texts. Just download the chosen language and drag and drop it in your Xcode Project. Do not change the name of the file before adding it to the Xcode Project. If your app supports multiple languages, repeat the process for every language.
Usage
let title = TextManager.shared.string(forKey: "title")
If the key you are expecting for doesn't exist on the back office, the function returns the parameter you passed. In the exemple, you'll get the value "title" in the variable title.
You can also add variables directly inside the text manager. Surround the variable with two double sharp, as following :
welcome_text : "Hello, ##USER_NAME##, how are you ?"
To inject the value, use the native stringWithFormat
method :
let welcomeText = TextManager.shared.string(forKey: "welcome_text", keyedArguments: ["user_name": "Damian"])
You can also omit the argument keys, there is only one argument or if you're sure the arguments are all placed in the same order for all languages.
let welcomeText = TextManager.shared.string(forKey: "welcome_text", arguments: ["Damian"])
// Or even shorter
let welcomeText = TextManager.shared.string(forKey: "welcome_text", "Damian")
Updated over 3 years ago