Classes

The following classes are available globally.

  • Class that holds the configuration of the pushTranslations() method that controls various aspect of the push to CDS.

    See more

    Declaration

    Swift

    public final class TXPushConfiguration : NSObject
  • Cache provider that loads translations from disk

    See more

    Declaration

    Swift

    public final class TXDiskCacheProvider : NSObject, TXCacheProvider
  • Decorator class managing an internal class and propagating the get() and update() protocol method calls to said cache.

    See more

    Declaration

    Swift

    open class TXDecoratorCache : NSObject, TXCache
  • Decorator class responsible for storing any updates of the translations to a file url specified in the constructor.

    See more

    Declaration

    Swift

    public final class TXFileOutputCacheDecorator : TXDecoratorCache
  • Class that makes the internal cache read-only so that no update operations are allowed.

    See more

    Declaration

    Swift

    public final class TXReadonlyCacheDecorator : TXDecoratorCache
  • Composite class that accepts a number of cache providers and an internal cache. The providers are then used to update the internal class in the order they are added in the providers list.

    Example usage:

    let cache = TXProviderBasedCache(
        providers: [
            TXDiskCacheProvider(fileURL: firstFileURL),
            TXDiskCacheProvider(fileURL: secondFileURL)
        ],
        internalCache: TXMemoryCache()
    )
    
    See more

    Declaration

    Swift

    public final class TXProviderBasedCache : TXDecoratorCache
  • Class responsible for updating the passed internalCache using a certain update policy defined in the TXCacheUpdatePolicy enum. This is done by filtering any translations that are passed via the update(translations:) call using an update policy that checks both the passed translations and the internal cache state to decide whether a translation should update the internal cache or not.

    See more

    Declaration

    Swift

    public final class TXStringUpdateFilterCache : TXDecoratorCache
  • The standard cache that the TXNative SDK is initialized with, if no other cache is provided.

    The cache gets initialized using the decorators implemented in the Caches.swift file of the SDK so that it reads from any existing translation files either from the app bundle or the app sandbox. The cache is also responsible for creating or updating the sandbox file with new translations when they will become available and it offers a memory cache for retrieving such translations so that they can be displayed in the UI.

    See more

    Declaration

    Swift

    public final class TXStandardCache : NSObject
  • A simple in-memory cache that updates its contents and returns the proper translation.

    This class is not thread-safe, so be sure that you are calling the update / get methods from a serial queue.

    See more

    Declaration

    Swift

    public final class TXMemoryCache : NSObject
    extension TXMemoryCache: TXCache
  • A no-op cache that doesn’t support storing the values in-memory. Useful when the library needs to be initialized without a cache (e.g. for the CLI tool).

    See more

    Declaration

    Swift

    public final class TXNoOpCache : NSObject, TXCache
  • A static class that is the main point of entry for all the functionality of Transifex Native throughout the SDK.

    See more

    Declaration

    Swift

    public final class TXNative : NSObject
  • Class that returns the active language code that can be used for localization, based on the current user’s language preferences and the locales that the application supports. The class falls back to “en” if the language code cannot be found.

    See more

    Declaration

    Swift

    public final class TXPreferredLocaleProvider : NSObject
    extension TXPreferredLocaleProvider : TXCurrentLocaleProvider
  • Keeps track of the locale-related information for the application, such as supported locales, source and current locale.

    See more

    Declaration

    Swift

    public final class TXLocaleState : NSObject
  • Class responsible for control logging in the SDK, allowing external log handlers to be updated by SDK clients via the TXLogHandler protocol.

    By default, TXLogger is initialized with a TXStandardLogHandler instance set to log only warning and error log messages.

    See more

    Declaration

    Swift

    public final class TXLogger : NSObject
  • Helper log handler that accepts a minimum allowed log level.

    If the SDK tries to log a level lower that the one passed in the initialization, then the message is not logged.

    See more

    Declaration

    Swift

    public class TXStandardLogHandler : NSObject
    extension TXStandardLogHandler: TXLogHandler
  • Utility class that allows SDK clients to leverage the logic used for pluralization rules.

    See more

    Declaration

    Swift

    public final class PluralUtils
  • Returns the source string when the translation string is missing.

    See more

    Declaration

    Swift

    public final class TXSourceStringPolicy : NSObject, TXMissingPolicy
  • Returns a string that looks like the source string but contains accented characters.

    Example: PseudoTranslationPolicy().get("The quick brown fox") Returns: Ťȟê ʠüıċǩ ƀȓøẁñ ƒøẋ

    See more

    Declaration

    Swift

    public final class TXPseudoTranslationPolicy : NSObject, TXMissingPolicy
  • Wraps the returned string with a custom format.

    Example: WrappedStringPolicy(">>", "<<").get("Click here") Returns: >>Click here<<

    See more

    Declaration

    Swift

    public final class TXWrappedStringPolicy : NSObject, TXMissingPolicy
  • Combines multiple policies to create a complex result.

    The result of each policy if fed to the next as source.

    See more

    Declaration

    Swift

    public final class TXCompositePolicy : NSObject, TXMissingPolicy
  • An error policy that simply returns the string that is going to be rendered in the UI instead of the translation.

    See more

    Declaration

    Swift

    public final class TXRenderedSourceErrorPolicy : TXErrorPolicy
  • Publicly exposed class that holds all the information for the translation units that will be pushed to CDS.

    This class mirrors the internal SourceString struct and offers a flat structure of the required and optional properties of the struct while also being able to be used both by Swift and Objective-C applications.

    See more

    Declaration

    Swift

    public final class TXSourceString : NSObject