LocalizedString

data class LocalizedString(val translations: Map<String?, LocalizedString.Translation> = emptyMap()) : JSONable, Parcelable

Represents a string with multiple translations indexed by a BCP 47 language tag.

Constructors

Link copied to clipboard
constructor(translations: Map<String?, LocalizedString.Translation> = emptyMap())
constructor(value: String, lang: String? = null)

Shortcut to create a LocalizedString using a single string for a given language.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Translation(val string: String) : Parcelable

Properties

Link copied to clipboard

The default translation for this localized string.

Link copied to clipboard

The default translation string for this localized string. This is a shortcut for apps.

Functions

Link copied to clipboard
fun copyWithString(language: String?, string: String): LocalizedString

Returns a new LocalizedString after adding (or replacing) the translation with the given language.

Link copied to clipboard
abstract fun describeContents(): Int
Link copied to clipboard

Returns the first translation for the given language BCP–47 tag. If not found, then fallback: 1. on the default Locale 2. on the undefined language 3. on the English language 4. the first translation found

Link copied to clipboard

Returns a new LocalizedString after applying the transform function to each language.

Link copied to clipboard

Returns a new LocalizedString after applying the transform function to each translation.

Link copied to clipboard
open override fun toJSON(): JSONObject

Serializes a LocalizedString to its RWPM JSON representation.

Link copied to clipboard
abstract fun writeToParcel(p0: Parcel, p1: Int)