File tree 1 file changed +13
-5
lines changed
Sources/CoreUsefulSDK/Extensions
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -59,14 +59,22 @@ public extension String {
59
59
/// Returns localized string.
60
60
var localized : String {
61
61
if NSLocalizedString ( self , comment: self ) . isEmpty {
62
- if let enPath = Bundle . main. path ( forResource: " en " , ofType: " lproj " ) {
63
- let enBundle = Bundle ( path: enPath)
64
- return enBundle? . localizedString ( forKey: self , value: self , table: nil ) ?? " "
65
- }
62
+ return enLocalized
63
+ }
64
+ return NSLocalizedString ( self , comment: self )
65
+ }
66
+
67
+ /// returns localized string in english or empty string
68
+ var enLocalized : String {
69
+ if let enPath = Bundle . main. path ( forResource: " en " , ofType: " lproj " ) {
70
+ let enBundle = Bundle ( path: enPath)
71
+ return enBundle? . localizedString ( forKey: self , value: self , table: nil ) ?? " "
66
72
}
67
- return NSLocalizedString ( self , comment : self )
73
+ return " "
68
74
}
69
75
76
+
77
+
70
78
/// Returns attributed string
71
79
func attributed( with attributes: [ NSAttributedString . Key : Any ] ) -> NSAttributedString {
72
80
return NSMutableAttributedString ( string: self , attributes: attributes)
You can’t perform that action at this time.
0 commit comments