├── LocalizedEngine.podspec ├── LocalizedEngine ├── LocalizedEngine.h └── LocalizedEngine.m ├── LocalizedEngineDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── heroims.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── heroims.xcuserdatad │ └── xcschemes │ ├── LocalizedEngineDemo.xcscheme │ └── xcschememanagement.plist ├── LocalizedEngineDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m ├── en.lproj │ ├── InfoPlist.strings │ ├── LaunchScreen.strings │ └── Localizable.strings ├── main.m └── zh-Hans.lproj │ ├── InfoPlist.strings │ ├── LaunchScreen.strings │ └── Localizable.strings ├── LocalizedEngineDemoTests ├── Info.plist └── LocalizedEngineDemoTests.m ├── LocalizedEngineDemoUITests ├── Info.plist └── LocalizedEngineDemoUITests.m └── README.md /LocalizedEngine.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'LocalizedEngine' 3 | s.version = '1.0' 4 | s.summary = 'A Localized Engine ' 5 | s.homepage = 'https://github.com/heroims/LocalizedEngine' 6 | s.license = { :type => 'MIT', :file => 'README.md' } 7 | s.author = { 'heroims' => 'heroims@163.com' } 8 | s.source = { :git => 'https://github.com/heroims/LocalizedEngine.git', :tag => "#{s.version}" } 9 | s.platform = :ios, '7.0' 10 | s.source_files = 'LocalizedEngine/*.{h,m}' 11 | s.requires_arc = true 12 | end 13 | -------------------------------------------------------------------------------- /LocalizedEngine/LocalizedEngine.h: -------------------------------------------------------------------------------- 1 | // 2 | // LocalizedEngine.h 3 | // admin 4 | // 5 | // Created by admin on 2017/1/23. 6 | // Copyright © 2017年 admin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (LocalizedEngineSwizzling) 12 | 13 | @property(nonatomic,assign)BOOL disableAutoLocalized; 14 | 15 | @end 16 | 17 | @interface LocalizedEngine : NSObject 18 | 19 | +(void)startEngine; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /LocalizedEngine/LocalizedEngine.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // LocalizedEngine.m 4 | // xgoods 5 | // 6 | // Created by admin on 2017/1/23. 7 | // Copyright © 2017年 admin. All rights reserved. 8 | // 9 | 10 | #import "LocalizedEngine.h" 11 | #import 12 | #import 13 | 14 | #define LocalizedString(string) NSLocalizedString(string, nil) 15 | 16 | @implementation NSObject (LocalizedEngineSwizzling) 17 | 18 | - (BOOL)disableAutoLocalized{ 19 | return [objc_getAssociatedObject(self, @selector(disableAutoLocalized)) boolValue]; 20 | } 21 | 22 | -(void)setDisableAutoLocalized:(BOOL)disableAutoLocalized{ 23 | objc_setAssociatedObject(self, @selector(disableAutoLocalized), @(disableAutoLocalized), OBJC_ASSOCIATION_RETAIN); 24 | } 25 | 26 | + (BOOL)les_swizzleMethod:(SEL)origSel withMethod:(SEL)altSel { 27 | Method origMethod = class_getInstanceMethod(self, origSel); 28 | Method altMethod = class_getInstanceMethod(self, altSel); 29 | if (!origMethod || !altMethod) { 30 | return NO; 31 | } 32 | class_addMethod(self, 33 | origSel, 34 | class_getMethodImplementation(self, origSel), 35 | method_getTypeEncoding(origMethod)); 36 | class_addMethod(self, 37 | altSel, 38 | class_getMethodImplementation(self, altSel), 39 | method_getTypeEncoding(altMethod)); 40 | method_exchangeImplementations(class_getInstanceMethod(self, origSel), 41 | class_getInstanceMethod(self, altSel)); 42 | return YES; 43 | } 44 | 45 | + (BOOL)les_swizzleClassMethod:(SEL)origSel withMethod:(SEL)altSel { 46 | return [object_getClass((id)self) les_swizzleMethod:origSel withMethod:altSel]; 47 | } 48 | 49 | @end 50 | 51 | @interface NSAttributedString (LocalizedEngine) 52 | 53 | @end 54 | @implementation NSAttributedString (LocalizedEngine) 55 | 56 | - (instancetype)le_initWithString:(NSString *)str{ 57 | return [self le_initWithString:self.disableAutoLocalized?str:LocalizedString(str)]; 58 | } 59 | - (instancetype)le_initWithString:(NSString *)str attributes:(nullable NSDictionary *)attrs{ 60 | return [self le_initWithString:self.disableAutoLocalized?str:LocalizedString(str) attributes:attrs]; 61 | } 62 | 63 | @end 64 | 65 | @interface NSString (LocalizedEngine) 66 | 67 | @end 68 | 69 | @implementation NSString(LocalizedEngine) 70 | 71 | -(CGRect)le_boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(nullable NSDictionary *)attributes context:(nullable NSStringDrawingContext *)context{ 72 | return [self.disableAutoLocalized?self:LocalizedString(self) le_boundingRectWithSize:size options:options attributes:attributes context:context]; 73 | } 74 | 75 | - (CGSize)le_sizeWithAttributes:(nullable NSDictionary *)attrs{ 76 | return [self.disableAutoLocalized?self:LocalizedString(self) le_sizeWithAttributes:attrs]; 77 | } 78 | @end 79 | 80 | @interface UILabel (LocalizedEngine) 81 | 82 | @end 83 | 84 | @implementation UILabel(LocalizedEngine) 85 | 86 | -(void)le_setText:(NSString *)text{ 87 | [self le_setText:self.disableAutoLocalized?text:LocalizedString(text)]; 88 | } 89 | 90 | @end 91 | 92 | @interface UITabBarItem (LocalizedEngine) 93 | 94 | @end 95 | @implementation UITabBarItem (LocalizedEngine) 96 | 97 | -(void)le_setTitle:(NSString *)title{ 98 | [self le_setTitle:self.disableAutoLocalized?title:LocalizedString(title)]; 99 | } 100 | 101 | @end 102 | 103 | @interface UINavigationItem (LocalizedEngine) 104 | 105 | @end 106 | @implementation UINavigationItem (LocalizedEngine) 107 | 108 | -(void)le_setTitle:(NSString *)title{ 109 | [self le_setTitle:self.disableAutoLocalized?title:LocalizedString(title)]; 110 | } 111 | 112 | @end 113 | @interface UIViewController (LocalizedEngine) 114 | 115 | @end 116 | @implementation UIViewController (LocalizedEngine) 117 | 118 | -(void)le_setTitle:(NSString *)title{ 119 | [self le_setTitle:self.disableAutoLocalized?title:LocalizedString(title)]; 120 | } 121 | 122 | @end 123 | 124 | @interface UIButton (LocalizedEngine) 125 | 126 | @end 127 | @implementation UIButton (LocalizedEngine) 128 | 129 | -(void)le_setTitle:(NSString *)title forState:(UIControlState)state{ 130 | [self le_setTitle:self.disableAutoLocalized?title:LocalizedString(title) forState:state]; 131 | } 132 | 133 | @end 134 | 135 | @interface UITextField (LocalizedEngine) 136 | 137 | @end 138 | @implementation UITextField (LocalizedEngine) 139 | 140 | -(void)le_setText:(NSString *)text{ 141 | [self le_setText:self.disableAutoLocalized?text:LocalizedString(text)]; 142 | } 143 | 144 | -(void)le_setPlaceholder:(NSString *)placeholder{ 145 | [self le_setPlaceholder:self.disableAutoLocalized?placeholder:LocalizedString(placeholder)]; 146 | } 147 | 148 | @end 149 | 150 | @interface UITextView (LocalizedEngine) 151 | 152 | @end 153 | @implementation UITextView (LocalizedEngine) 154 | 155 | -(void)le_setText:(NSString *)text{ 156 | [self le_setText:self.disableAutoLocalized?text:LocalizedString(text)]; 157 | } 158 | 159 | @end 160 | 161 | @implementation LocalizedEngine 162 | 163 | +(void)startEngine{ 164 | [[UITextField class] les_swizzleMethod:@selector(setText:) withMethod:@selector(le_setText:)]; 165 | [[UITextField class] les_swizzleMethod:@selector(setPlaceholder:) withMethod:@selector(le_setPlaceholder:)]; 166 | [[UITextView class] les_swizzleMethod:@selector(setText:) withMethod:@selector(le_setText:)]; 167 | [[UILabel class] les_swizzleMethod:@selector(setText:) withMethod:@selector(le_setText:)]; 168 | [[UITabBarItem class] les_swizzleMethod:@selector(setTitle:) withMethod:@selector(le_setTitle:)]; 169 | [[UINavigationItem class] les_swizzleMethod:@selector(setTitle:) withMethod:@selector(le_setTitle:)]; 170 | [[UIViewController class] les_swizzleMethod:@selector(setTitle:) withMethod:@selector(le_setTitle:)]; 171 | [[UIButton class] les_swizzleMethod:@selector(setTitle:forState:) withMethod:@selector(le_setTitle:forState:)]; 172 | [[NSString class] les_swizzleMethod:@selector(boundingRectWithSize:options:attributes:context:) withMethod:@selector(le_boundingRectWithSize:options:attributes:context:)]; 173 | [[NSString class] les_swizzleMethod:@selector(sizeWithAttributes:) withMethod:@selector(le_sizeWithAttributes:)]; 174 | [[NSAttributedString class] les_swizzleMethod:@selector(initWithString:) withMethod:@selector(le_initWithString:)]; 175 | [[NSAttributedString class] les_swizzleMethod:@selector(initWithString:attributes:) withMethod:@selector(le_initWithString:attributes:)]; 176 | 177 | } 178 | 179 | @end 180 | -------------------------------------------------------------------------------- /LocalizedEngineDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D8DE20E01E50C5DD0022705C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D8DE20DF1E50C5DD0022705C /* main.m */; }; 11 | D8DE20E31E50C5DD0022705C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D8DE20E21E50C5DD0022705C /* AppDelegate.m */; }; 12 | D8DE20E61E50C5DD0022705C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D8DE20E51E50C5DD0022705C /* ViewController.m */; }; 13 | D8DE20EB1E50C5DD0022705C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D8DE20EA1E50C5DD0022705C /* Assets.xcassets */; }; 14 | D8DE20F91E50C5DD0022705C /* LocalizedEngineDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D8DE20F81E50C5DD0022705C /* LocalizedEngineDemoTests.m */; }; 15 | D8DE21041E50C5DD0022705C /* LocalizedEngineDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = D8DE21031E50C5DD0022705C /* LocalizedEngineDemoUITests.m */; }; 16 | D8DE21141E50C6BD0022705C /* LocalizedEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = D8DE21131E50C6BD0022705C /* LocalizedEngine.m */; }; 17 | D8DE211C1E50D1170022705C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D8DE211E1E50D1170022705C /* InfoPlist.strings */; }; 18 | D8DE21221E50D17A0022705C /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = D8DE21241E50D17A0022705C /* Localizable.strings */; }; 19 | D8DE21401E50DCB30022705C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D8DE21421E50DCB30022705C /* LaunchScreen.storyboard */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | D8DE20F51E50C5DD0022705C /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = D8DE20D31E50C5DC0022705C /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = D8DE20DA1E50C5DD0022705C; 28 | remoteInfo = LocalizedEngineDemo; 29 | }; 30 | D8DE21001E50C5DD0022705C /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = D8DE20D31E50C5DC0022705C /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = D8DE20DA1E50C5DD0022705C; 35 | remoteInfo = LocalizedEngineDemo; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | D8DE20DB1E50C5DD0022705C /* LocalizedEngineDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LocalizedEngineDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | D8DE20DF1E50C5DD0022705C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | D8DE20E11E50C5DD0022705C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | D8DE20E21E50C5DD0022705C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | D8DE20E41E50C5DD0022705C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 45 | D8DE20E51E50C5DD0022705C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 46 | D8DE20EA1E50C5DD0022705C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | D8DE20EF1E50C5DD0022705C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | D8DE20F41E50C5DD0022705C /* LocalizedEngineDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocalizedEngineDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | D8DE20F81E50C5DD0022705C /* LocalizedEngineDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalizedEngineDemoTests.m; sourceTree = ""; }; 50 | D8DE20FA1E50C5DD0022705C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | D8DE20FF1E50C5DD0022705C /* LocalizedEngineDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocalizedEngineDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | D8DE21031E50C5DD0022705C /* LocalizedEngineDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalizedEngineDemoUITests.m; sourceTree = ""; }; 53 | D8DE21051E50C5DD0022705C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | D8DE21121E50C6BD0022705C /* LocalizedEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedEngine.h; sourceTree = ""; }; 55 | D8DE21131E50C6BD0022705C /* LocalizedEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalizedEngine.m; sourceTree = ""; }; 56 | D8DE211D1E50D1170022705C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = ""; }; 57 | D8DE211F1E50D11A0022705C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 58 | D8DE21251E50D17C0022705C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 59 | D8DE21261E50D1CF0022705C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; 60 | D8DE21411E50DCB30022705C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 61 | D8DE21441E50DCB70022705C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/LaunchScreen.strings; sourceTree = ""; }; 62 | D8DE21461E50DCB80022705C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | D8DE20D81E50C5DD0022705C /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | D8DE20F11E50C5DD0022705C /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | D8DE20FC1E50C5DD0022705C /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | D8DE20D21E50C5DC0022705C = { 91 | isa = PBXGroup; 92 | children = ( 93 | D8DE20DD1E50C5DD0022705C /* LocalizedEngineDemo */, 94 | D8DE20F71E50C5DD0022705C /* LocalizedEngineDemoTests */, 95 | D8DE21021E50C5DD0022705C /* LocalizedEngineDemoUITests */, 96 | D8DE20DC1E50C5DD0022705C /* Products */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | D8DE20DC1E50C5DD0022705C /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | D8DE20DB1E50C5DD0022705C /* LocalizedEngineDemo.app */, 104 | D8DE20F41E50C5DD0022705C /* LocalizedEngineDemoTests.xctest */, 105 | D8DE20FF1E50C5DD0022705C /* LocalizedEngineDemoUITests.xctest */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | D8DE20DD1E50C5DD0022705C /* LocalizedEngineDemo */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | D8DE21111E50C6BD0022705C /* LocalizedEngine */, 114 | D8DE20E11E50C5DD0022705C /* AppDelegate.h */, 115 | D8DE20E21E50C5DD0022705C /* AppDelegate.m */, 116 | D8DE20E41E50C5DD0022705C /* ViewController.h */, 117 | D8DE20E51E50C5DD0022705C /* ViewController.m */, 118 | D8DE21421E50DCB30022705C /* LaunchScreen.storyboard */, 119 | D8DE20EA1E50C5DD0022705C /* Assets.xcassets */, 120 | D8DE20EF1E50C5DD0022705C /* Info.plist */, 121 | D8DE211E1E50D1170022705C /* InfoPlist.strings */, 122 | D8DE21241E50D17A0022705C /* Localizable.strings */, 123 | D8DE20DE1E50C5DD0022705C /* Supporting Files */, 124 | ); 125 | path = LocalizedEngineDemo; 126 | sourceTree = ""; 127 | }; 128 | D8DE20DE1E50C5DD0022705C /* Supporting Files */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | D8DE20DF1E50C5DD0022705C /* main.m */, 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | D8DE20F71E50C5DD0022705C /* LocalizedEngineDemoTests */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | D8DE20F81E50C5DD0022705C /* LocalizedEngineDemoTests.m */, 140 | D8DE20FA1E50C5DD0022705C /* Info.plist */, 141 | ); 142 | path = LocalizedEngineDemoTests; 143 | sourceTree = ""; 144 | }; 145 | D8DE21021E50C5DD0022705C /* LocalizedEngineDemoUITests */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | D8DE21031E50C5DD0022705C /* LocalizedEngineDemoUITests.m */, 149 | D8DE21051E50C5DD0022705C /* Info.plist */, 150 | ); 151 | path = LocalizedEngineDemoUITests; 152 | sourceTree = ""; 153 | }; 154 | D8DE21111E50C6BD0022705C /* LocalizedEngine */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | D8DE21121E50C6BD0022705C /* LocalizedEngine.h */, 158 | D8DE21131E50C6BD0022705C /* LocalizedEngine.m */, 159 | ); 160 | path = LocalizedEngine; 161 | sourceTree = SOURCE_ROOT; 162 | }; 163 | /* End PBXGroup section */ 164 | 165 | /* Begin PBXNativeTarget section */ 166 | D8DE20DA1E50C5DD0022705C /* LocalizedEngineDemo */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = D8DE21081E50C5DD0022705C /* Build configuration list for PBXNativeTarget "LocalizedEngineDemo" */; 169 | buildPhases = ( 170 | D8DE20D71E50C5DD0022705C /* Sources */, 171 | D8DE20D81E50C5DD0022705C /* Frameworks */, 172 | D8DE20D91E50C5DD0022705C /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | ); 178 | name = LocalizedEngineDemo; 179 | productName = LocalizedEngineDemo; 180 | productReference = D8DE20DB1E50C5DD0022705C /* LocalizedEngineDemo.app */; 181 | productType = "com.apple.product-type.application"; 182 | }; 183 | D8DE20F31E50C5DD0022705C /* LocalizedEngineDemoTests */ = { 184 | isa = PBXNativeTarget; 185 | buildConfigurationList = D8DE210B1E50C5DD0022705C /* Build configuration list for PBXNativeTarget "LocalizedEngineDemoTests" */; 186 | buildPhases = ( 187 | D8DE20F01E50C5DD0022705C /* Sources */, 188 | D8DE20F11E50C5DD0022705C /* Frameworks */, 189 | D8DE20F21E50C5DD0022705C /* Resources */, 190 | ); 191 | buildRules = ( 192 | ); 193 | dependencies = ( 194 | D8DE20F61E50C5DD0022705C /* PBXTargetDependency */, 195 | ); 196 | name = LocalizedEngineDemoTests; 197 | productName = LocalizedEngineDemoTests; 198 | productReference = D8DE20F41E50C5DD0022705C /* LocalizedEngineDemoTests.xctest */; 199 | productType = "com.apple.product-type.bundle.unit-test"; 200 | }; 201 | D8DE20FE1E50C5DD0022705C /* LocalizedEngineDemoUITests */ = { 202 | isa = PBXNativeTarget; 203 | buildConfigurationList = D8DE210E1E50C5DD0022705C /* Build configuration list for PBXNativeTarget "LocalizedEngineDemoUITests" */; 204 | buildPhases = ( 205 | D8DE20FB1E50C5DD0022705C /* Sources */, 206 | D8DE20FC1E50C5DD0022705C /* Frameworks */, 207 | D8DE20FD1E50C5DD0022705C /* Resources */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | D8DE21011E50C5DD0022705C /* PBXTargetDependency */, 213 | ); 214 | name = LocalizedEngineDemoUITests; 215 | productName = LocalizedEngineDemoUITests; 216 | productReference = D8DE20FF1E50C5DD0022705C /* LocalizedEngineDemoUITests.xctest */; 217 | productType = "com.apple.product-type.bundle.ui-testing"; 218 | }; 219 | /* End PBXNativeTarget section */ 220 | 221 | /* Begin PBXProject section */ 222 | D8DE20D31E50C5DC0022705C /* Project object */ = { 223 | isa = PBXProject; 224 | attributes = { 225 | LastUpgradeCheck = 0820; 226 | ORGANIZATIONNAME = "Zhao Yiqi"; 227 | TargetAttributes = { 228 | D8DE20DA1E50C5DD0022705C = { 229 | CreatedOnToolsVersion = 8.2.1; 230 | DevelopmentTeam = YDDJ83LVSQ; 231 | ProvisioningStyle = Automatic; 232 | }; 233 | D8DE20F31E50C5DD0022705C = { 234 | CreatedOnToolsVersion = 8.2.1; 235 | DevelopmentTeam = YDDJ83LVSQ; 236 | ProvisioningStyle = Automatic; 237 | TestTargetID = D8DE20DA1E50C5DD0022705C; 238 | }; 239 | D8DE20FE1E50C5DD0022705C = { 240 | CreatedOnToolsVersion = 8.2.1; 241 | DevelopmentTeam = YDDJ83LVSQ; 242 | ProvisioningStyle = Automatic; 243 | TestTargetID = D8DE20DA1E50C5DD0022705C; 244 | }; 245 | }; 246 | }; 247 | buildConfigurationList = D8DE20D61E50C5DD0022705C /* Build configuration list for PBXProject "LocalizedEngineDemo" */; 248 | compatibilityVersion = "Xcode 3.2"; 249 | developmentRegion = English; 250 | hasScannedForEncodings = 0; 251 | knownRegions = ( 252 | en, 253 | Base, 254 | "zh-Hans", 255 | ); 256 | mainGroup = D8DE20D21E50C5DC0022705C; 257 | productRefGroup = D8DE20DC1E50C5DD0022705C /* Products */; 258 | projectDirPath = ""; 259 | projectRoot = ""; 260 | targets = ( 261 | D8DE20DA1E50C5DD0022705C /* LocalizedEngineDemo */, 262 | D8DE20F31E50C5DD0022705C /* LocalizedEngineDemoTests */, 263 | D8DE20FE1E50C5DD0022705C /* LocalizedEngineDemoUITests */, 264 | ); 265 | }; 266 | /* End PBXProject section */ 267 | 268 | /* Begin PBXResourcesBuildPhase section */ 269 | D8DE20D91E50C5DD0022705C /* Resources */ = { 270 | isa = PBXResourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | D8DE21221E50D17A0022705C /* Localizable.strings in Resources */, 274 | D8DE21401E50DCB30022705C /* LaunchScreen.storyboard in Resources */, 275 | D8DE211C1E50D1170022705C /* InfoPlist.strings in Resources */, 276 | D8DE20EB1E50C5DD0022705C /* Assets.xcassets in Resources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | D8DE20F21E50C5DD0022705C /* Resources */ = { 281 | isa = PBXResourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | D8DE20FD1E50C5DD0022705C /* Resources */ = { 288 | isa = PBXResourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | /* End PBXResourcesBuildPhase section */ 295 | 296 | /* Begin PBXSourcesBuildPhase section */ 297 | D8DE20D71E50C5DD0022705C /* Sources */ = { 298 | isa = PBXSourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | D8DE20E61E50C5DD0022705C /* ViewController.m in Sources */, 302 | D8DE21141E50C6BD0022705C /* LocalizedEngine.m in Sources */, 303 | D8DE20E31E50C5DD0022705C /* AppDelegate.m in Sources */, 304 | D8DE20E01E50C5DD0022705C /* main.m in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | D8DE20F01E50C5DD0022705C /* Sources */ = { 309 | isa = PBXSourcesBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | D8DE20F91E50C5DD0022705C /* LocalizedEngineDemoTests.m in Sources */, 313 | ); 314 | runOnlyForDeploymentPostprocessing = 0; 315 | }; 316 | D8DE20FB1E50C5DD0022705C /* Sources */ = { 317 | isa = PBXSourcesBuildPhase; 318 | buildActionMask = 2147483647; 319 | files = ( 320 | D8DE21041E50C5DD0022705C /* LocalizedEngineDemoUITests.m in Sources */, 321 | ); 322 | runOnlyForDeploymentPostprocessing = 0; 323 | }; 324 | /* End PBXSourcesBuildPhase section */ 325 | 326 | /* Begin PBXTargetDependency section */ 327 | D8DE20F61E50C5DD0022705C /* PBXTargetDependency */ = { 328 | isa = PBXTargetDependency; 329 | target = D8DE20DA1E50C5DD0022705C /* LocalizedEngineDemo */; 330 | targetProxy = D8DE20F51E50C5DD0022705C /* PBXContainerItemProxy */; 331 | }; 332 | D8DE21011E50C5DD0022705C /* PBXTargetDependency */ = { 333 | isa = PBXTargetDependency; 334 | target = D8DE20DA1E50C5DD0022705C /* LocalizedEngineDemo */; 335 | targetProxy = D8DE21001E50C5DD0022705C /* PBXContainerItemProxy */; 336 | }; 337 | /* End PBXTargetDependency section */ 338 | 339 | /* Begin PBXVariantGroup section */ 340 | D8DE211E1E50D1170022705C /* InfoPlist.strings */ = { 341 | isa = PBXVariantGroup; 342 | children = ( 343 | D8DE211D1E50D1170022705C /* zh-Hans */, 344 | D8DE211F1E50D11A0022705C /* en */, 345 | ); 346 | name = InfoPlist.strings; 347 | sourceTree = ""; 348 | }; 349 | D8DE21241E50D17A0022705C /* Localizable.strings */ = { 350 | isa = PBXVariantGroup; 351 | children = ( 352 | D8DE21251E50D17C0022705C /* en */, 353 | D8DE21261E50D1CF0022705C /* zh-Hans */, 354 | ); 355 | name = Localizable.strings; 356 | sourceTree = ""; 357 | }; 358 | D8DE21421E50DCB30022705C /* LaunchScreen.storyboard */ = { 359 | isa = PBXVariantGroup; 360 | children = ( 361 | D8DE21411E50DCB30022705C /* Base */, 362 | D8DE21441E50DCB70022705C /* en */, 363 | D8DE21461E50DCB80022705C /* zh-Hans */, 364 | ); 365 | name = LaunchScreen.storyboard; 366 | sourceTree = ""; 367 | }; 368 | /* End PBXVariantGroup section */ 369 | 370 | /* Begin XCBuildConfiguration section */ 371 | D8DE21061E50C5DD0022705C /* Debug */ = { 372 | isa = XCBuildConfiguration; 373 | buildSettings = { 374 | ALWAYS_SEARCH_USER_PATHS = NO; 375 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 376 | CLANG_ANALYZER_NONNULL = YES; 377 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 378 | CLANG_CXX_LIBRARY = "libc++"; 379 | CLANG_ENABLE_MODULES = YES; 380 | CLANG_ENABLE_OBJC_ARC = YES; 381 | CLANG_WARN_BOOL_CONVERSION = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 384 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 385 | CLANG_WARN_EMPTY_BODY = YES; 386 | CLANG_WARN_ENUM_CONVERSION = YES; 387 | CLANG_WARN_INFINITE_RECURSION = YES; 388 | CLANG_WARN_INT_CONVERSION = YES; 389 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 390 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | COPY_PHASE_STRIP = NO; 395 | DEBUG_INFORMATION_FORMAT = dwarf; 396 | ENABLE_STRICT_OBJC_MSGSEND = YES; 397 | ENABLE_TESTABILITY = YES; 398 | GCC_C_LANGUAGE_STANDARD = gnu99; 399 | GCC_DYNAMIC_NO_PIC = NO; 400 | GCC_NO_COMMON_BLOCKS = YES; 401 | GCC_OPTIMIZATION_LEVEL = 0; 402 | GCC_PREPROCESSOR_DEFINITIONS = ( 403 | "DEBUG=1", 404 | "$(inherited)", 405 | ); 406 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 407 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 408 | GCC_WARN_UNDECLARED_SELECTOR = YES; 409 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 410 | GCC_WARN_UNUSED_FUNCTION = YES; 411 | GCC_WARN_UNUSED_VARIABLE = YES; 412 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 413 | MTL_ENABLE_DEBUG_INFO = YES; 414 | ONLY_ACTIVE_ARCH = YES; 415 | SDKROOT = iphoneos; 416 | TARGETED_DEVICE_FAMILY = "1,2"; 417 | }; 418 | name = Debug; 419 | }; 420 | D8DE21071E50C5DD0022705C /* Release */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | ALWAYS_SEARCH_USER_PATHS = NO; 424 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 425 | CLANG_ANALYZER_NONNULL = YES; 426 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 427 | CLANG_CXX_LIBRARY = "libc++"; 428 | CLANG_ENABLE_MODULES = YES; 429 | CLANG_ENABLE_OBJC_ARC = YES; 430 | CLANG_WARN_BOOL_CONVERSION = YES; 431 | CLANG_WARN_CONSTANT_CONVERSION = YES; 432 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 433 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 434 | CLANG_WARN_EMPTY_BODY = YES; 435 | CLANG_WARN_ENUM_CONVERSION = YES; 436 | CLANG_WARN_INFINITE_RECURSION = YES; 437 | CLANG_WARN_INT_CONVERSION = YES; 438 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 439 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 440 | CLANG_WARN_UNREACHABLE_CODE = YES; 441 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 442 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 443 | COPY_PHASE_STRIP = NO; 444 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 445 | ENABLE_NS_ASSERTIONS = NO; 446 | ENABLE_STRICT_OBJC_MSGSEND = YES; 447 | GCC_C_LANGUAGE_STANDARD = gnu99; 448 | GCC_NO_COMMON_BLOCKS = YES; 449 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 450 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 451 | GCC_WARN_UNDECLARED_SELECTOR = YES; 452 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 453 | GCC_WARN_UNUSED_FUNCTION = YES; 454 | GCC_WARN_UNUSED_VARIABLE = YES; 455 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 456 | MTL_ENABLE_DEBUG_INFO = NO; 457 | SDKROOT = iphoneos; 458 | TARGETED_DEVICE_FAMILY = "1,2"; 459 | VALIDATE_PRODUCT = YES; 460 | }; 461 | name = Release; 462 | }; 463 | D8DE21091E50C5DD0022705C /* Debug */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 467 | DEVELOPMENT_TEAM = YDDJ83LVSQ; 468 | INFOPLIST_FILE = LocalizedEngineDemo/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 470 | PRODUCT_BUNDLE_IDENTIFIER = com.zyq.LocalizedEngineDemo; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | }; 473 | name = Debug; 474 | }; 475 | D8DE210A1E50C5DD0022705C /* Release */ = { 476 | isa = XCBuildConfiguration; 477 | buildSettings = { 478 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 479 | DEVELOPMENT_TEAM = YDDJ83LVSQ; 480 | INFOPLIST_FILE = LocalizedEngineDemo/Info.plist; 481 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 482 | PRODUCT_BUNDLE_IDENTIFIER = com.zyq.LocalizedEngineDemo; 483 | PRODUCT_NAME = "$(TARGET_NAME)"; 484 | }; 485 | name = Release; 486 | }; 487 | D8DE210C1E50C5DD0022705C /* Debug */ = { 488 | isa = XCBuildConfiguration; 489 | buildSettings = { 490 | BUNDLE_LOADER = "$(TEST_HOST)"; 491 | DEVELOPMENT_TEAM = YDDJ83LVSQ; 492 | INFOPLIST_FILE = LocalizedEngineDemoTests/Info.plist; 493 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 494 | PRODUCT_BUNDLE_IDENTIFIER = com.zyq.LocalizedEngineDemoTests; 495 | PRODUCT_NAME = "$(TARGET_NAME)"; 496 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LocalizedEngineDemo.app/LocalizedEngineDemo"; 497 | }; 498 | name = Debug; 499 | }; 500 | D8DE210D1E50C5DD0022705C /* Release */ = { 501 | isa = XCBuildConfiguration; 502 | buildSettings = { 503 | BUNDLE_LOADER = "$(TEST_HOST)"; 504 | DEVELOPMENT_TEAM = YDDJ83LVSQ; 505 | INFOPLIST_FILE = LocalizedEngineDemoTests/Info.plist; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 507 | PRODUCT_BUNDLE_IDENTIFIER = com.zyq.LocalizedEngineDemoTests; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LocalizedEngineDemo.app/LocalizedEngineDemo"; 510 | }; 511 | name = Release; 512 | }; 513 | D8DE210F1E50C5DD0022705C /* Debug */ = { 514 | isa = XCBuildConfiguration; 515 | buildSettings = { 516 | DEVELOPMENT_TEAM = YDDJ83LVSQ; 517 | INFOPLIST_FILE = LocalizedEngineDemoUITests/Info.plist; 518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 519 | PRODUCT_BUNDLE_IDENTIFIER = com.zyq.LocalizedEngineDemoUITests; 520 | PRODUCT_NAME = "$(TARGET_NAME)"; 521 | TEST_TARGET_NAME = LocalizedEngineDemo; 522 | }; 523 | name = Debug; 524 | }; 525 | D8DE21101E50C5DD0022705C /* Release */ = { 526 | isa = XCBuildConfiguration; 527 | buildSettings = { 528 | DEVELOPMENT_TEAM = YDDJ83LVSQ; 529 | INFOPLIST_FILE = LocalizedEngineDemoUITests/Info.plist; 530 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 531 | PRODUCT_BUNDLE_IDENTIFIER = com.zyq.LocalizedEngineDemoUITests; 532 | PRODUCT_NAME = "$(TARGET_NAME)"; 533 | TEST_TARGET_NAME = LocalizedEngineDemo; 534 | }; 535 | name = Release; 536 | }; 537 | /* End XCBuildConfiguration section */ 538 | 539 | /* Begin XCConfigurationList section */ 540 | D8DE20D61E50C5DD0022705C /* Build configuration list for PBXProject "LocalizedEngineDemo" */ = { 541 | isa = XCConfigurationList; 542 | buildConfigurations = ( 543 | D8DE21061E50C5DD0022705C /* Debug */, 544 | D8DE21071E50C5DD0022705C /* Release */, 545 | ); 546 | defaultConfigurationIsVisible = 0; 547 | defaultConfigurationName = Release; 548 | }; 549 | D8DE21081E50C5DD0022705C /* Build configuration list for PBXNativeTarget "LocalizedEngineDemo" */ = { 550 | isa = XCConfigurationList; 551 | buildConfigurations = ( 552 | D8DE21091E50C5DD0022705C /* Debug */, 553 | D8DE210A1E50C5DD0022705C /* Release */, 554 | ); 555 | defaultConfigurationIsVisible = 0; 556 | defaultConfigurationName = Release; 557 | }; 558 | D8DE210B1E50C5DD0022705C /* Build configuration list for PBXNativeTarget "LocalizedEngineDemoTests" */ = { 559 | isa = XCConfigurationList; 560 | buildConfigurations = ( 561 | D8DE210C1E50C5DD0022705C /* Debug */, 562 | D8DE210D1E50C5DD0022705C /* Release */, 563 | ); 564 | defaultConfigurationIsVisible = 0; 565 | defaultConfigurationName = Release; 566 | }; 567 | D8DE210E1E50C5DD0022705C /* Build configuration list for PBXNativeTarget "LocalizedEngineDemoUITests" */ = { 568 | isa = XCConfigurationList; 569 | buildConfigurations = ( 570 | D8DE210F1E50C5DD0022705C /* Debug */, 571 | D8DE21101E50C5DD0022705C /* Release */, 572 | ); 573 | defaultConfigurationIsVisible = 0; 574 | defaultConfigurationName = Release; 575 | }; 576 | /* End XCConfigurationList section */ 577 | }; 578 | rootObject = D8DE20D31E50C5DC0022705C /* Project object */; 579 | } 580 | -------------------------------------------------------------------------------- /LocalizedEngineDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LocalizedEngineDemo.xcodeproj/project.xcworkspace/xcuserdata/heroims.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heroims/LocalizedEngine/ae1d30645f0e421965050a46d125b4c49bc134d3/LocalizedEngineDemo.xcodeproj/project.xcworkspace/xcuserdata/heroims.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LocalizedEngineDemo.xcodeproj/xcuserdata/heroims.xcuserdatad/xcschemes/LocalizedEngineDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /LocalizedEngineDemo.xcodeproj/xcuserdata/heroims.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LocalizedEngineDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D8DE20DA1E50C5DD0022705C 16 | 17 | primary 18 | 19 | 20 | D8DE20F31E50C5DD0022705C 21 | 22 | primary 23 | 24 | 25 | D8DE20FE1E50C5DD0022705C 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LocalizedEngineDemo 4 | // 5 | // Created by Zhao Yiqi on 2017/2/13. 6 | // Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LocalizedEngineDemo 4 | // 5 | // Created by Zhao Yiqi on 2017/2/13. 6 | // Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | #import "LocalizedEngine.h" 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | [LocalizedEngine startEngine]; 22 | 23 | // Override point for customization after application launch. 24 | self.window=[[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 25 | UITabBarController *tabController=[[UITabBarController alloc] init]; 26 | 27 | ViewController *vc1=[[ViewController alloc] init]; 28 | vc1.title=@"title1"; 29 | UINavigationController *nav1=[[UINavigationController alloc] initWithRootViewController:vc1]; 30 | ViewController *vc2=[[ViewController alloc] init]; 31 | vc2.title=@"标题2"; 32 | UINavigationController *nav2=[[UINavigationController alloc] initWithRootViewController:vc2]; 33 | ViewController *vc3=[[ViewController alloc] init]; 34 | vc3.title=@"title3"; 35 | UINavigationController *nav3=[[UINavigationController alloc] initWithRootViewController:vc3]; 36 | 37 | [tabController setViewControllers:@[nav1,nav2,nav3]]; 38 | 39 | self.window.rootViewController=tabController; 40 | 41 | 42 | [self.window makeKeyAndVisible]; 43 | return YES; 44 | } 45 | 46 | 47 | - (void)applicationWillResignActive:(UIApplication *)application { 48 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 49 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 50 | } 51 | 52 | 53 | - (void)applicationDidEnterBackground:(UIApplication *)application { 54 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 55 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 56 | } 57 | 58 | 59 | - (void)applicationWillEnterForeground:(UIApplication *)application { 60 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 61 | } 62 | 63 | 64 | - (void)applicationDidBecomeActive:(UIApplication *)application { 65 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 66 | } 67 | 68 | 69 | - (void)applicationWillTerminate:(UIApplication *)application { 70 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 71 | } 72 | 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /LocalizedEngineDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | zh_CN 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | 本地化应用 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LocalizedEngineDemo 4 | // 5 | // Created by Zhao Yiqi on 2017/2/13. 6 | // Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LocalizedEngineDemo 4 | // 5 | // Created by Zhao Yiqi on 2017/2/13. 6 | // Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | self.view.backgroundColor=[UIColor whiteColor]; 21 | 22 | UIButton *btn=[UIButton buttonWithType:UIButtonTypeRoundedRect]; 23 | btn.frame=CGRectMake(0, 0, 200, 60); 24 | btn.center=self.view.center; 25 | [btn setTitle:@"点击" forState:UIControlStateNormal]; 26 | [self.view addSubview:btn]; 27 | [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside]; 28 | // Do any additional setup after loading the view, typically from a nib. 29 | } 30 | 31 | -(void)btnClick{ 32 | UIAlertController *alert=[UIAlertController alertControllerWithTitle:@"message title" message:@"message text" preferredStyle:UIAlertControllerStyleAlert]; 33 | [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { 34 | [alert dismissViewControllerAnimated:YES completion:nil]; 35 | }]]; 36 | [self presentViewController:alert animated:YES completion:nil]; 37 | } 38 | 39 | - (void)didReceiveMemoryWarning { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* 2 | InfoPlist.strings 3 | LocalizedEngineDemo 4 | 5 | Created by Zhao Yiqi on 2017/2/13. 6 | Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | */ 8 | "CFBundleDisplayName" = "LocalizedApp"; 9 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/en.lproj/LaunchScreen.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UILabel"; text = "LocalizedEngineDemo"; ObjectID = "GJd-Yh-RWb"; */ 3 | "GJd-Yh-RWb.text" = "不要多想这是静态页文本无效"; 4 | 5 | /* Class = "UILabel"; text = " Copyright © 2017年 Zhao Yiqi. All rights reserved."; ObjectID = "obG-Y5-kRd"; */ 6 | "obG-Y5-kRd.text" = "除了LaunchScreen以外都没事,LaunchScreen图片本地化还是可以的"; 7 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | LocalizedEngineDemo 4 | 5 | Created by Zhao Yiqi on 2017/2/13. 6 | Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | */ 8 | 9 | "点击" = "touch"; 10 | "标题2" = "title2"; 11 | "初始化" = "First Lauch"; 12 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LocalizedEngineDemo 4 | // 5 | // Created by Zhao Yiqi on 2017/2/13. 6 | // Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/zh-Hans.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* 2 | InfoPlist.strings 3 | LocalizedEngineDemo 4 | 5 | Created by Zhao Yiqi on 2017/2/13. 6 | Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | */ 8 | "CFBundleDisplayName" = "本地化应用"; 9 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/zh-Hans.lproj/LaunchScreen.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UILabel"; text = "LocalizedEngineDemo"; ObjectID = "GJd-Yh-RWb"; */ 3 | "GJd-Yh-RWb.text" = "123123"; 4 | 5 | /* Class = "UILabel"; text = " Copyright © 2017年 Zhao Yiqi. All rights reserved."; ObjectID = "obG-Y5-kRd"; */ 6 | "obG-Y5-kRd.text" = " Copyright © 2017年 Zhao Yiqi. All rights reserved."; 7 | -------------------------------------------------------------------------------- /LocalizedEngineDemo/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | LocalizedEngineDemo 4 | 5 | Created by Zhao Yiqi on 2017/2/13. 6 | Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | */ 8 | 9 | "message title" = "提示标题"; 10 | "message text" = "提示文本"; 11 | "OK" = "确定"; 12 | "title1" = "标题1"; 13 | "title3" = "标题3"; 14 | 15 | -------------------------------------------------------------------------------- /LocalizedEngineDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LocalizedEngineDemoTests/LocalizedEngineDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LocalizedEngineDemoTests.m 3 | // LocalizedEngineDemoTests 4 | // 5 | // Created by Zhao Yiqi on 2017/2/13. 6 | // Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LocalizedEngineDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LocalizedEngineDemoTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /LocalizedEngineDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LocalizedEngineDemoUITests/LocalizedEngineDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LocalizedEngineDemoUITests.m 3 | // LocalizedEngineDemoUITests 4 | // 5 | // Created by Zhao Yiqi on 2017/2/13. 6 | // Copyright © 2017年 Zhao Yiqi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LocalizedEngineDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LocalizedEngineDemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LocalizedEngine 2 | ## 国际化引擎 3 | 使用方法调用 4 | ```Objective-C 5 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 6 | //初始化国际化引擎 7 | [LocalizedEngine startEngine]; 8 | 9 | return YES; 10 | } 11 | 12 | ``` 13 | 14 | ## Installation 15 | 16 | ### via CocoaPods 17 | Install CocoaPods if you do not have it:- 18 | ```` 19 | $ [sudo] gem install cocoapods 20 | $ pod setup 21 | ```` 22 | Create Podfile:- 23 | ```` 24 | $ edit Podfile 25 | platform :ios, '7.0' 26 | pod 'LocalizedEngine', '~> 1.0' 27 | $ pod install 28 | ```` 29 | Use the Xcode workspace instead of the project from now on. 30 | --------------------------------------------------------------------------------