TXCache

@objc
public protocol TXCache

A protocol for classes that act as cache for translations.

  • Gets all of the translations from the cache.

    Declaration

    Swift

    func get() -> TXTranslations
  • Get the translation for a certain key and locale code pair.

    Declaration

    Swift

    func get(key: String, localeCode: String) -> String?

    Parameters

    key

    the key of the string

    localeCode

    the locale code

  • Update the cache with a dictionary containing locale codes as keys and a list of translations as values like this:

    {
        'fr' : {
             'key1' : { 'string' : '...' },
             'key2' : { 'string' : '...' },
        },
        'de' : {
             'key3' : { 'string' : '...' },
        },
        'gr' : {
             'key4' : { 'string' : '...' },
        },
    }
    

    Declaration

    Swift

    func update(translations: TXTranslations)

    Parameters

    translations

    The dictionary structure of translations