Classes

The following classes are available globally.

  • Class represents single expression that is added in curly brackets inside key in Localizable.strings file or as a value in Expressions.strings file.

    It is able to validate passed string using internal expression matcher.

    See more

    Declaration

    Swift

    class Expression
  • Class uses NSRegularExpression internally and simplifies its usability.

    See more

    Declaration

    Swift

    class Regex
  • Parser that parses expressions that contains regular expressions.

    See more

    Declaration

    Swift

    class RegexExpressionParser: ExpressionParser
  • Contains base expressions that matches every country.

    See more

    Declaration

    Swift

    class SharedBaseExpression: SharedExpressionProtocol
  • Swifternalization contains some built-in country-related shared expressions. Developer can create its own expressions in Expressions.strings file for base and preferred language version of the file.

    The class is responsible for proper loading the built-in shared ones and those loaded from project’s files. It handles overriding of built-in and loads those from Base and preferred language version.

    It always load base expressions, then looking for language specific. If in Base file are some expressions that overrides built-in, that’s fine the class adds or developer’s custom expressions and add only those of built-in that are not contained in the Base.

    The same is for preferred languages but also here what is important is that at first preferred language file expressions are loaded, then if something different is defined in Base it will be also loaded and then the built-in expression that differs.

    See more

    Declaration

    Swift

    class SharedExpressionsConfigurator
  • This is the main class of Swifternalization library. It exposes methods that can be used to get localized keys with or without expressions from Localizable.strings files.

    It also uses Expressions.strings files to manage shared expressions that can have theirs identifiers placed in many versions of the Localizable.strings file.

    Internal classes of the Swifternalization contains logic that is responsible for detecting which value should be used for the given key and value.

    It is able to work with genstrings command-line tool like NSLocalizedString() macro does.

    It looks for content in the NSBundle you can provide and try to find:

    • Localizable.strings (Base),
    • Localizable.strings of preferred language, e.g. Localizable.strings (en)
    • Expressions.strings (Base),
    • Expressions.strings of preferred language, e.g. Expressions.strings (en)
    See more

    Declaration

    Swift

    public class Swifternalization