diff options
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/src/MGLClockDirectionFormatter.m | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLCompassDirectionFormatter.m | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLCoordinateFormatter.m | 1 | ||||
-rw-r--r-- | platform/darwin/src/NSBundle+MGLAdditions.h | 19 |
4 files changed, 24 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLClockDirectionFormatter.m b/platform/darwin/src/MGLClockDirectionFormatter.m index 56740e74e3..8047b41b35 100644 --- a/platform/darwin/src/MGLClockDirectionFormatter.m +++ b/platform/darwin/src/MGLClockDirectionFormatter.m @@ -1,5 +1,7 @@ #import "MGLClockDirectionFormatter.h" +#import "NSBundle+MGLAdditions.h" + #define wrap(value, min, max) \ (fmod((fmod((value - min), (max - min)) + (max - min)), (max - min)) + min) diff --git a/platform/darwin/src/MGLCompassDirectionFormatter.m b/platform/darwin/src/MGLCompassDirectionFormatter.m index efda5705a4..f719745ce6 100644 --- a/platform/darwin/src/MGLCompassDirectionFormatter.m +++ b/platform/darwin/src/MGLCompassDirectionFormatter.m @@ -1,5 +1,7 @@ #import "MGLCompassDirectionFormatter.h" +#import "NSBundle+MGLAdditions.h" + #define wrap(value, min, max) \ (fmod((fmod((value - min), (max - min)) + (max - min)), (max - min)) + min) diff --git a/platform/darwin/src/MGLCoordinateFormatter.m b/platform/darwin/src/MGLCoordinateFormatter.m index 259917717f..4ef5409380 100644 --- a/platform/darwin/src/MGLCoordinateFormatter.m +++ b/platform/darwin/src/MGLCoordinateFormatter.m @@ -1,5 +1,6 @@ #import "MGLCoordinateFormatter.h" +#import "NSBundle+MGLAdditions.h" #import "NSValue+MGLAdditions.h" @implementation MGLCoordinateFormatter { diff --git a/platform/darwin/src/NSBundle+MGLAdditions.h b/platform/darwin/src/NSBundle+MGLAdditions.h index 8a3e5c3c2e..bab70f38bc 100644 --- a/platform/darwin/src/NSBundle+MGLAdditions.h +++ b/platform/darwin/src/NSBundle+MGLAdditions.h @@ -4,6 +4,25 @@ NS_ASSUME_NONNULL_BEGIN +// Strings in the SDK targets must be retrieved from the framework bundle rather +// than the main bundle, which is usually the application bundle. Redefining +// these macros ensures that the framework bundle’s string tables are used at +// runtime yet tools like genstrings and Xcode can still find the localizable +// string identifiers. (genstrings has an -s option that would allow us to +// define our own macros, but Xcode’s Export Localization feature lacks support +// for it.) +// +// As a consequence of this approach, this header must be included in all SDK +// files that include localizable strings. + +#undef NSLocalizedString +#define NSLocalizedString(key, comment) \ + [[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:nil] + +#undef NSLocalizedStringFromTable +#define NSLocalizedStringFromTable(key, tbl, comment) \ + [[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:@"" table:(tbl)] + @interface NSBundle (MGLAdditions) /// Returns the bundle containing the SDK’s classes and Info.plist file. |