codeandtheory / YCoreUI

Core components for iOS and tvOS to accelerate building user interfaces in code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expand Localizable with tableName

mpospese opened this issue · comments

Let's expand our Localizable protocol to include tableName support.

  1. add static var tableName: String? to Localizable
  2. add a default implementation of tableName to return nil
  3. expand String.localized to add table tableName: String? = nil second parameter and pass that to the internal call to NSLocalizedString.
  4. expand the default implementation of Localizable.localized to pass Self.tableName to String.localized(bundle:tableName:)

(Basically everywhere we're using bundle in conjunction with Localizable, we should also use tableName.

  1. make sure all public interfaces are fully documented with documentation comments
  2. make sure new code paths are fully covered with unit tests (see String+LocalizedTests.swift)
  3. for testing let's add a new Settings.strings file under Tests/YCoreUITests/Assets/Strings/en.lproj and add 3 string values to it. Declare a new SettingsConstants enum which overrides tableName to find to the right strings file. Test that all the values in this enum load properly.