Files
MapLibreParticleLab/platform/darwin/src/NSBundle+MGLAdditions.h
Minh Nguyễn f1200d47db [ios, osx] Made localizable strings unique; unlocalized iosapp
Assigned unique IDs to localizable English strings in code.

Made iosapp non-localizable. For the time being, it isn’t worth the trouble to localize more strings for this demo application than for the SDK itself.
2016-04-24 16:17:43 -07:00

46 lines
1.7 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#import <Foundation/Foundation.h>
#import "MGLTypes.h"
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)]
#undef NSLocalizedStringWithDefaultValue
#define NSLocalizedStringWithDefaultValue(key, tbl, bundle, val, comment) \
[[NSBundle mgl_frameworkBundle] localizedStringForKey:(key) value:(val) table:(tbl)]
@interface NSBundle (MGLAdditions)
/// Returns the bundle containing the SDK’s classes and Info.plist file.
+ (instancetype)mgl_frameworkBundle;
+ (nullable NSString *)mgl_frameworkBundleIdentifier;
+ (nullable NS_DICTIONARY_OF(NSString *, id) *)mgl_frameworkInfoDictionary;
/// The relative path to the directory containing the SDK’s resource files, or
/// `nil` if the files are located directly within the bundle’s root directory.
@property (readonly, copy, nullable) NSString *mgl_resourcesDirectory;
@end
NS_ASSUME_NONNULL_END