I did the customization of an attribute with the simple solution of localizing the attribute by code:
private struct AssociatedKeys {
static var someTagKey = "someTag"
}
@IBInspectable var someTag: String? {
get {
return NSLocalizedString(
objc_getAssociatedObject(self, &AssociatedKeys.someTagsKey) as? String ?? "", comment: "")
}
set {
if let newValue = newValue {
objc_setAssociatedObject(
self,
&AssociatedKeys.someTagsKey,
newValue as NSString?,
objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC
)
}
}
}
And after that you can easily extract all the strings from the xib and storyboard files with an egrep:
egrep -ohr --include="*.xib" --include="*.storyboard" '<userDefinedRuntimeAttribute type="string" keyPath="someTag" value="[^"]+"/>' . >> extracted-strings.txt
And after that eliminate the tags in the strings file by the following sed and then you have to plain strings file for xcode ready:
sed -i -e 's/^<userDefinedRuntimeAttribute type="string" keyPath="someTag" value=\("[^"]*"\)\/>/\1 = \1;/g' extracted-strings.txt