commit | author | age
|
a0a843
|
1 |
// |
H |
2 |
// TWTRResoucesUtil.h |
|
3 |
// TwitterKit |
|
4 |
// |
|
5 |
// Created by Kang Chen on 8/22/14. |
|
6 |
// Copyright (c) 2014 Twitter. All rights reserved. |
|
7 |
// |
|
8 |
|
|
9 |
#import <Foundation/Foundation.h> |
|
10 |
|
|
11 |
#if IS_UIKIT_AVAILABLE |
|
12 |
#import <UIKit/UIKit.h> |
|
13 |
#else |
|
14 |
#import <Cocoa/Cocoa.h> |
|
15 |
#endif |
|
16 |
|
|
17 |
NS_ASSUME_NONNULL_BEGIN |
|
18 |
|
|
19 |
FOUNDATION_EXPORT NSString *const TWTRResourcesUtilLanguageType; |
|
20 |
|
|
21 |
@interface TWTRResourcesUtil : NSObject |
|
22 |
|
|
23 |
/** |
|
24 |
* Returns the bundle given its name. This is useful for retrieving any bundle and future refactoring |
|
25 |
* such as when Digits has its own kit resources. |
|
26 |
* |
|
27 |
* @param bundlePath path of the bundle e.g. TwitterKitResources.bundle |
|
28 |
* |
|
29 |
* @return the bundle |
|
30 |
*/ |
|
31 |
+ (NSBundle *)bundleWithBundlePath:(NSString *)bundlePath; |
|
32 |
|
|
33 |
/** |
|
34 |
* Retrieves the localized bundle of the given resource bundle. |
|
35 |
* |
|
36 |
* @param bundle localized bundle |
|
37 |
* |
|
38 |
* @return localized bundle |
|
39 |
*/ |
|
40 |
+ (NSBundle *)localizedBundleWithBundle:(NSBundle *)bundle; |
|
41 |
|
|
42 |
/** |
|
43 |
* Retrieves the localized bundle for the given bundle path. |
|
44 |
* |
|
45 |
* @param bundlePath path of the bundle e.g. TwitterKitResources.bundle |
|
46 |
* |
|
47 |
* @return localized bundle in the given resource bundle path |
|
48 |
*/ |
|
49 |
+ (NSBundle *)localizedBundleWithBundlePath:(NSString *)bundlePath; |
|
50 |
|
|
51 |
/** |
|
52 |
* Retrieves the localized string for the given key. If the string is not found in the right locale strings file, falls back to English. |
|
53 |
* |
|
54 |
* @param key key for the desired localized string, e.g. "BUTTON_OKAY" |
|
55 |
* @param bundlePath path of the bundle e.g. TwitterKitResources.bundle |
|
56 |
* |
|
57 |
* @return localized string |
|
58 |
*/ |
|
59 |
+ (NSString *)localizedStringForKey:(NSString *)key bundlePath:(NSString *)bundlePath; |
|
60 |
|
|
61 |
/** |
|
62 |
* Constructs the canonical user agent string based on |
|
63 |
* kit info in the main bundle. |
|
64 |
* |
|
65 |
* @return Kit user agent string for URL requests. |
|
66 |
*/ |
|
67 |
+ (NSString *)userAgentFromKitBundle; |
|
68 |
|
|
69 |
/** |
|
70 |
* Returns the localized display name of the application. |
|
71 |
*/ |
|
72 |
+ (NSString *)localizedApplicationDisplayName; |
|
73 |
|
|
74 |
/** |
|
75 |
* Returns the platform of the application. |
|
76 |
*/ |
|
77 |
+ (NSString *)platform; |
|
78 |
|
|
79 |
/** |
|
80 |
* Returns the screen scale of the application. |
|
81 |
*/ |
|
82 |
+ (CGFloat)screenScale; |
|
83 |
|
|
84 |
/** |
|
85 |
* Set the version of the parent Kit (Twitter Kit or Digits) |
|
86 |
*/ |
|
87 |
+ (void)setKitVersion:(nullable NSString *)version; |
|
88 |
|
|
89 |
@end |
|
90 |
|
|
91 |
NS_ASSUME_NONNULL_END |