Expand Localizable with tableName
mpospese opened this issue · comments
Mark Pospesel commented
Let's expand our Localizable protocol to include tableName support.
- add
static var tableName: String?
toLocalizable
- add a default implementation of
tableName
to returnnil
- expand
String.localized
to addtable tableName: String? = nil
second parameter and pass that to the internal call toNSLocalizedString
. - expand the default implementation of
Localizable.localized
to passSelf.tableName
toString.localized(bundle:tableName:)
(Basically everywhere we're using bundle
in conjunction with Localizable
, we should also use tableName
.
- make sure all public interfaces are fully documented with documentation comments
- make sure new code paths are fully covered with unit tests (see
String+LocalizedTests.swift
) - for testing let's add a new
Settings.strings
file underTests/YCoreUITests/Assets/Strings/en.lproj
and add 3 string values to it. Declare a newSettingsConstants
enum which overrides tableName to find to the right strings file. Test that all the values in this enum load properly.