├── README.md ├── localizationDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── prashant.xcuserdatad │ └── xcschemes │ ├── localizationDemo.xcscheme │ └── xcschememanagement.plist ├── localizationDemo ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ ├── Localizable.strings │ └── Main.storyboard ├── Info.plist ├── Item1ViewController.swift ├── Item2ViewController.swift ├── LanguageUtilities │ ├── DT_Icons.png │ ├── PPButton.swift │ ├── PPLabel.swift │ └── PPLocalization.swift ├── MainTabBarController.swift ├── ar.lproj │ └── Localizable.strings ├── en.lproj │ └── Localizable.strings └── localizationDemo-Bridging-Header.h ├── localizationDemoTests ├── Info.plist └── localizationDemoTests.swift └── localizationDemoUITests ├── Info.plist └── localizationDemoUITests.swift /README.md: -------------------------------------------------------------------------------- 1 | # localization_Swift 2 | 3 | ![simulator1](https://user-images.githubusercontent.com/14121989/30425791-e2ebb884-9967-11e7-8845-0309d5389fd9.png) 4 | -------------------------------------------------------------------------------- /localizationDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8F99CC311F6A48E2003F947F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F99CC301F6A48E2003F947F /* AppDelegate.swift */; }; 11 | 8F99CC361F6A48E2003F947F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F99CC341F6A48E2003F947F /* Main.storyboard */; }; 12 | 8F99CC381F6A48E2003F947F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8F99CC371F6A48E2003F947F /* Assets.xcassets */; }; 13 | 8F99CC3B1F6A48E2003F947F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F99CC391F6A48E2003F947F /* LaunchScreen.storyboard */; }; 14 | 8F99CC461F6A48E2003F947F /* localizationDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F99CC451F6A48E2003F947F /* localizationDemoTests.swift */; }; 15 | 8F99CC511F6A48E2003F947F /* localizationDemoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F99CC501F6A48E2003F947F /* localizationDemoUITests.swift */; }; 16 | 8F99CC5F1F6A4A57003F947F /* Item1ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F99CC5E1F6A4A57003F947F /* Item1ViewController.swift */; }; 17 | 8F99CC611F6A4A66003F947F /* Item2ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F99CC601F6A4A66003F947F /* Item2ViewController.swift */; }; 18 | 8F99CC751F6A4BD8003F947F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8F99CC771F6A4BD8003F947F /* Localizable.strings */; }; 19 | 8F99CCB21F6A5B9F003F947F /* PPLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F99CCB11F6A5B9F003F947F /* PPLabel.swift */; }; 20 | 8F99CCB41F6A5DB7003F947F /* PPLocalization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F99CCB31F6A5DB7003F947F /* PPLocalization.swift */; }; 21 | 8FAA37CB1F6A7E0A00907C98 /* MainTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FAA37CA1F6A7E0A00907C98 /* MainTabBarController.swift */; }; 22 | 8FAA37CD1F6A80FD00907C98 /* PPButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FAA37CC1F6A80FD00907C98 /* PPButton.swift */; }; 23 | 8FAA38331F6A8CA400907C98 /* DT_Icons.png in Resources */ = {isa = PBXBuildFile; fileRef = 8FAA38321F6A8CA400907C98 /* DT_Icons.png */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 8F99CC421F6A48E2003F947F /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 8F99CC251F6A48E1003F947F /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 8F99CC2C1F6A48E1003F947F; 32 | remoteInfo = localizationDemo; 33 | }; 34 | 8F99CC4D1F6A48E2003F947F /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 8F99CC251F6A48E1003F947F /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 8F99CC2C1F6A48E1003F947F; 39 | remoteInfo = localizationDemo; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 8F99CC2D1F6A48E1003F947F /* localizationDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = localizationDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 8F99CC301F6A48E2003F947F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 46 | 8F99CC351F6A48E2003F947F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 8F99CC371F6A48E2003F947F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | 8F99CC3A1F6A48E2003F947F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | 8F99CC3C1F6A48E2003F947F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 8F99CC411F6A48E2003F947F /* localizationDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = localizationDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 8F99CC451F6A48E2003F947F /* localizationDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = localizationDemoTests.swift; sourceTree = ""; }; 52 | 8F99CC471F6A48E2003F947F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 8F99CC4C1F6A48E2003F947F /* localizationDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = localizationDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 8F99CC501F6A48E2003F947F /* localizationDemoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = localizationDemoUITests.swift; sourceTree = ""; }; 55 | 8F99CC521F6A48E2003F947F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 8F99CC5E1F6A4A57003F947F /* Item1ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Item1ViewController.swift; sourceTree = ""; }; 57 | 8F99CC601F6A4A66003F947F /* Item2ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Item2ViewController.swift; sourceTree = ""; }; 58 | 8F99CC761F6A4BD8003F947F /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = ""; }; 59 | 8F99CC781F6A4BD9003F947F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 60 | 8F99CC791F6A4BED003F947F /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = ""; }; 61 | 8F99CCAE1F6A584A003F947F /* localizationDemo-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "localizationDemo-Bridging-Header.h"; sourceTree = ""; }; 62 | 8F99CCB11F6A5B9F003F947F /* PPLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PPLabel.swift; sourceTree = ""; }; 63 | 8F99CCB31F6A5DB7003F947F /* PPLocalization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PPLocalization.swift; sourceTree = ""; }; 64 | 8FAA37CA1F6A7E0A00907C98 /* MainTabBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainTabBarController.swift; sourceTree = ""; }; 65 | 8FAA37CC1F6A80FD00907C98 /* PPButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PPButton.swift; sourceTree = ""; }; 66 | 8FAA38321F6A8CA400907C98 /* DT_Icons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DT_Icons.png; path = LanguageUtilities/DT_Icons.png; sourceTree = ""; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | 8F99CC2A1F6A48E1003F947F /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | 8F99CC3E1F6A48E2003F947F /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | 8F99CC491F6A48E2003F947F /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | /* End PBXFrameworksBuildPhase section */ 92 | 93 | /* Begin PBXGroup section */ 94 | 8F99CC241F6A48E1003F947F = { 95 | isa = PBXGroup; 96 | children = ( 97 | 8F99CC2F1F6A48E1003F947F /* localizationDemo */, 98 | 8F99CC441F6A48E2003F947F /* localizationDemoTests */, 99 | 8F99CC4F1F6A48E2003F947F /* localizationDemoUITests */, 100 | 8F99CC2E1F6A48E1003F947F /* Products */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | 8F99CC2E1F6A48E1003F947F /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 8F99CC2D1F6A48E1003F947F /* localizationDemo.app */, 108 | 8F99CC411F6A48E2003F947F /* localizationDemoTests.xctest */, 109 | 8F99CC4C1F6A48E2003F947F /* localizationDemoUITests.xctest */, 110 | ); 111 | name = Products; 112 | sourceTree = ""; 113 | }; 114 | 8F99CC2F1F6A48E1003F947F /* localizationDemo */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 8F99CCAE1F6A584A003F947F /* localizationDemo-Bridging-Header.h */, 118 | 8F99CCAA1F6A57B3003F947F /* LanguageUtilities */, 119 | 8F99CC301F6A48E2003F947F /* AppDelegate.swift */, 120 | 8FAA38321F6A8CA400907C98 /* DT_Icons.png */, 121 | 8F99CC341F6A48E2003F947F /* Main.storyboard */, 122 | 8F99CC371F6A48E2003F947F /* Assets.xcassets */, 123 | 8F99CC391F6A48E2003F947F /* LaunchScreen.storyboard */, 124 | 8F99CC3C1F6A48E2003F947F /* Info.plist */, 125 | 8F99CC5E1F6A4A57003F947F /* Item1ViewController.swift */, 126 | 8F99CC601F6A4A66003F947F /* Item2ViewController.swift */, 127 | 8FAA37CA1F6A7E0A00907C98 /* MainTabBarController.swift */, 128 | ); 129 | path = localizationDemo; 130 | sourceTree = ""; 131 | }; 132 | 8F99CC441F6A48E2003F947F /* localizationDemoTests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 8F99CC451F6A48E2003F947F /* localizationDemoTests.swift */, 136 | 8F99CC471F6A48E2003F947F /* Info.plist */, 137 | ); 138 | path = localizationDemoTests; 139 | sourceTree = ""; 140 | }; 141 | 8F99CC4F1F6A48E2003F947F /* localizationDemoUITests */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 8F99CC501F6A48E2003F947F /* localizationDemoUITests.swift */, 145 | 8F99CC521F6A48E2003F947F /* Info.plist */, 146 | ); 147 | path = localizationDemoUITests; 148 | sourceTree = ""; 149 | }; 150 | 8F99CCAA1F6A57B3003F947F /* LanguageUtilities */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 8F99CC771F6A4BD8003F947F /* Localizable.strings */, 154 | 8F99CCB11F6A5B9F003F947F /* PPLabel.swift */, 155 | 8F99CCB31F6A5DB7003F947F /* PPLocalization.swift */, 156 | 8FAA37CC1F6A80FD00907C98 /* PPButton.swift */, 157 | ); 158 | path = LanguageUtilities; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXNativeTarget section */ 164 | 8F99CC2C1F6A48E1003F947F /* localizationDemo */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = 8F99CC551F6A48E2003F947F /* Build configuration list for PBXNativeTarget "localizationDemo" */; 167 | buildPhases = ( 168 | 8F99CC291F6A48E1003F947F /* Sources */, 169 | 8F99CC2A1F6A48E1003F947F /* Frameworks */, 170 | 8F99CC2B1F6A48E1003F947F /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | ); 176 | name = localizationDemo; 177 | productName = localizationDemo; 178 | productReference = 8F99CC2D1F6A48E1003F947F /* localizationDemo.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | 8F99CC401F6A48E2003F947F /* localizationDemoTests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = 8F99CC581F6A48E2003F947F /* Build configuration list for PBXNativeTarget "localizationDemoTests" */; 184 | buildPhases = ( 185 | 8F99CC3D1F6A48E2003F947F /* Sources */, 186 | 8F99CC3E1F6A48E2003F947F /* Frameworks */, 187 | 8F99CC3F1F6A48E2003F947F /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 8F99CC431F6A48E2003F947F /* PBXTargetDependency */, 193 | ); 194 | name = localizationDemoTests; 195 | productName = localizationDemoTests; 196 | productReference = 8F99CC411F6A48E2003F947F /* localizationDemoTests.xctest */; 197 | productType = "com.apple.product-type.bundle.unit-test"; 198 | }; 199 | 8F99CC4B1F6A48E2003F947F /* localizationDemoUITests */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = 8F99CC5B1F6A48E2003F947F /* Build configuration list for PBXNativeTarget "localizationDemoUITests" */; 202 | buildPhases = ( 203 | 8F99CC481F6A48E2003F947F /* Sources */, 204 | 8F99CC491F6A48E2003F947F /* Frameworks */, 205 | 8F99CC4A1F6A48E2003F947F /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | 8F99CC4E1F6A48E2003F947F /* PBXTargetDependency */, 211 | ); 212 | name = localizationDemoUITests; 213 | productName = localizationDemoUITests; 214 | productReference = 8F99CC4C1F6A48E2003F947F /* localizationDemoUITests.xctest */; 215 | productType = "com.apple.product-type.bundle.ui-testing"; 216 | }; 217 | /* End PBXNativeTarget section */ 218 | 219 | /* Begin PBXProject section */ 220 | 8F99CC251F6A48E1003F947F /* Project object */ = { 221 | isa = PBXProject; 222 | attributes = { 223 | LastSwiftUpdateCheck = 0830; 224 | LastUpgradeCheck = 0830; 225 | ORGANIZATIONNAME = "Prashant Prajapati"; 226 | TargetAttributes = { 227 | 8F99CC2C1F6A48E1003F947F = { 228 | CreatedOnToolsVersion = 8.3.3; 229 | DevelopmentTeam = 4NS8D3NZ2F; 230 | ProvisioningStyle = Automatic; 231 | }; 232 | 8F99CC401F6A48E2003F947F = { 233 | CreatedOnToolsVersion = 8.3.3; 234 | DevelopmentTeam = 4NS8D3NZ2F; 235 | ProvisioningStyle = Automatic; 236 | TestTargetID = 8F99CC2C1F6A48E1003F947F; 237 | }; 238 | 8F99CC4B1F6A48E2003F947F = { 239 | CreatedOnToolsVersion = 8.3.3; 240 | DevelopmentTeam = 4NS8D3NZ2F; 241 | ProvisioningStyle = Automatic; 242 | TestTargetID = 8F99CC2C1F6A48E1003F947F; 243 | }; 244 | }; 245 | }; 246 | buildConfigurationList = 8F99CC281F6A48E1003F947F /* Build configuration list for PBXProject "localizationDemo" */; 247 | compatibilityVersion = "Xcode 3.2"; 248 | developmentRegion = English; 249 | hasScannedForEncodings = 0; 250 | knownRegions = ( 251 | en, 252 | Base, 253 | ar, 254 | ); 255 | mainGroup = 8F99CC241F6A48E1003F947F; 256 | productRefGroup = 8F99CC2E1F6A48E1003F947F /* Products */; 257 | projectDirPath = ""; 258 | projectRoot = ""; 259 | targets = ( 260 | 8F99CC2C1F6A48E1003F947F /* localizationDemo */, 261 | 8F99CC401F6A48E2003F947F /* localizationDemoTests */, 262 | 8F99CC4B1F6A48E2003F947F /* localizationDemoUITests */, 263 | ); 264 | }; 265 | /* End PBXProject section */ 266 | 267 | /* Begin PBXResourcesBuildPhase section */ 268 | 8F99CC2B1F6A48E1003F947F /* Resources */ = { 269 | isa = PBXResourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | 8F99CC3B1F6A48E2003F947F /* LaunchScreen.storyboard in Resources */, 273 | 8F99CC751F6A4BD8003F947F /* Localizable.strings in Resources */, 274 | 8F99CC381F6A48E2003F947F /* Assets.xcassets in Resources */, 275 | 8F99CC361F6A48E2003F947F /* Main.storyboard in Resources */, 276 | 8FAA38331F6A8CA400907C98 /* DT_Icons.png in Resources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | 8F99CC3F1F6A48E2003F947F /* Resources */ = { 281 | isa = PBXResourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | 8F99CC4A1F6A48E2003F947F /* Resources */ = { 288 | isa = PBXResourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | /* End PBXResourcesBuildPhase section */ 295 | 296 | /* Begin PBXSourcesBuildPhase section */ 297 | 8F99CC291F6A48E1003F947F /* Sources */ = { 298 | isa = PBXSourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | 8F99CC611F6A4A66003F947F /* Item2ViewController.swift in Sources */, 302 | 8F99CCB41F6A5DB7003F947F /* PPLocalization.swift in Sources */, 303 | 8FAA37CD1F6A80FD00907C98 /* PPButton.swift in Sources */, 304 | 8FAA37CB1F6A7E0A00907C98 /* MainTabBarController.swift in Sources */, 305 | 8F99CC5F1F6A4A57003F947F /* Item1ViewController.swift in Sources */, 306 | 8F99CCB21F6A5B9F003F947F /* PPLabel.swift in Sources */, 307 | 8F99CC311F6A48E2003F947F /* AppDelegate.swift in Sources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | 8F99CC3D1F6A48E2003F947F /* Sources */ = { 312 | isa = PBXSourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | 8F99CC461F6A48E2003F947F /* localizationDemoTests.swift in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | 8F99CC481F6A48E2003F947F /* Sources */ = { 320 | isa = PBXSourcesBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | 8F99CC511F6A48E2003F947F /* localizationDemoUITests.swift in Sources */, 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | /* End PBXSourcesBuildPhase section */ 328 | 329 | /* Begin PBXTargetDependency section */ 330 | 8F99CC431F6A48E2003F947F /* PBXTargetDependency */ = { 331 | isa = PBXTargetDependency; 332 | target = 8F99CC2C1F6A48E1003F947F /* localizationDemo */; 333 | targetProxy = 8F99CC421F6A48E2003F947F /* PBXContainerItemProxy */; 334 | }; 335 | 8F99CC4E1F6A48E2003F947F /* PBXTargetDependency */ = { 336 | isa = PBXTargetDependency; 337 | target = 8F99CC2C1F6A48E1003F947F /* localizationDemo */; 338 | targetProxy = 8F99CC4D1F6A48E2003F947F /* PBXContainerItemProxy */; 339 | }; 340 | /* End PBXTargetDependency section */ 341 | 342 | /* Begin PBXVariantGroup section */ 343 | 8F99CC341F6A48E2003F947F /* Main.storyboard */ = { 344 | isa = PBXVariantGroup; 345 | children = ( 346 | 8F99CC351F6A48E2003F947F /* Base */, 347 | ); 348 | name = Main.storyboard; 349 | sourceTree = ""; 350 | }; 351 | 8F99CC391F6A48E2003F947F /* LaunchScreen.storyboard */ = { 352 | isa = PBXVariantGroup; 353 | children = ( 354 | 8F99CC3A1F6A48E2003F947F /* Base */, 355 | ); 356 | name = LaunchScreen.storyboard; 357 | sourceTree = ""; 358 | }; 359 | 8F99CC771F6A4BD8003F947F /* Localizable.strings */ = { 360 | isa = PBXVariantGroup; 361 | children = ( 362 | 8F99CC761F6A4BD8003F947F /* Base */, 363 | 8F99CC781F6A4BD9003F947F /* en */, 364 | 8F99CC791F6A4BED003F947F /* ar */, 365 | ); 366 | name = Localizable.strings; 367 | path = ..; 368 | sourceTree = ""; 369 | }; 370 | /* End PBXVariantGroup section */ 371 | 372 | /* Begin XCBuildConfiguration section */ 373 | 8F99CC531F6A48E2003F947F /* Debug */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ALWAYS_SEARCH_USER_PATHS = NO; 377 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 378 | CLANG_ANALYZER_NONNULL = YES; 379 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 380 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 381 | CLANG_CXX_LIBRARY = "libc++"; 382 | CLANG_ENABLE_MODULES = YES; 383 | CLANG_ENABLE_OBJC_ARC = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 388 | CLANG_WARN_EMPTY_BODY = YES; 389 | CLANG_WARN_ENUM_CONVERSION = YES; 390 | CLANG_WARN_INFINITE_RECURSION = YES; 391 | CLANG_WARN_INT_CONVERSION = YES; 392 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 393 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 394 | CLANG_WARN_UNREACHABLE_CODE = YES; 395 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 396 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 397 | COPY_PHASE_STRIP = NO; 398 | DEBUG_INFORMATION_FORMAT = dwarf; 399 | ENABLE_STRICT_OBJC_MSGSEND = YES; 400 | ENABLE_TESTABILITY = YES; 401 | GCC_C_LANGUAGE_STANDARD = gnu99; 402 | GCC_DYNAMIC_NO_PIC = NO; 403 | GCC_NO_COMMON_BLOCKS = YES; 404 | GCC_OPTIMIZATION_LEVEL = 0; 405 | GCC_PREPROCESSOR_DEFINITIONS = ( 406 | "DEBUG=1", 407 | "$(inherited)", 408 | ); 409 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 410 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 411 | GCC_WARN_UNDECLARED_SELECTOR = YES; 412 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 413 | GCC_WARN_UNUSED_FUNCTION = YES; 414 | GCC_WARN_UNUSED_VARIABLE = YES; 415 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 416 | MTL_ENABLE_DEBUG_INFO = YES; 417 | ONLY_ACTIVE_ARCH = YES; 418 | SDKROOT = iphoneos; 419 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 420 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | 8F99CC541F6A48E2003F947F /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_SEARCH_USER_PATHS = NO; 429 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 430 | CLANG_ANALYZER_NONNULL = YES; 431 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 432 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 433 | CLANG_CXX_LIBRARY = "libc++"; 434 | CLANG_ENABLE_MODULES = YES; 435 | CLANG_ENABLE_OBJC_ARC = YES; 436 | CLANG_WARN_BOOL_CONVERSION = YES; 437 | CLANG_WARN_CONSTANT_CONVERSION = YES; 438 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 439 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 440 | CLANG_WARN_EMPTY_BODY = YES; 441 | CLANG_WARN_ENUM_CONVERSION = YES; 442 | CLANG_WARN_INFINITE_RECURSION = YES; 443 | CLANG_WARN_INT_CONVERSION = YES; 444 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 445 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 446 | CLANG_WARN_UNREACHABLE_CODE = YES; 447 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 448 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 449 | COPY_PHASE_STRIP = NO; 450 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 451 | ENABLE_NS_ASSERTIONS = NO; 452 | ENABLE_STRICT_OBJC_MSGSEND = YES; 453 | GCC_C_LANGUAGE_STANDARD = gnu99; 454 | GCC_NO_COMMON_BLOCKS = YES; 455 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 456 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 457 | GCC_WARN_UNDECLARED_SELECTOR = YES; 458 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 459 | GCC_WARN_UNUSED_FUNCTION = YES; 460 | GCC_WARN_UNUSED_VARIABLE = YES; 461 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 462 | MTL_ENABLE_DEBUG_INFO = NO; 463 | SDKROOT = iphoneos; 464 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 465 | TARGETED_DEVICE_FAMILY = "1,2"; 466 | VALIDATE_PRODUCT = YES; 467 | }; 468 | name = Release; 469 | }; 470 | 8F99CC561F6A48E2003F947F /* Debug */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 474 | DEVELOPMENT_TEAM = 4NS8D3NZ2F; 475 | INFOPLIST_FILE = localizationDemo/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 477 | PRODUCT_BUNDLE_IDENTIFIER = com.webmyne.localizationDemo; 478 | PRODUCT_NAME = "$(TARGET_NAME)"; 479 | SWIFT_OBJC_BRIDGING_HEADER = "$(inherited)"; 480 | SWIFT_VERSION = 3.0; 481 | }; 482 | name = Debug; 483 | }; 484 | 8F99CC571F6A48E2003F947F /* Release */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | DEVELOPMENT_TEAM = 4NS8D3NZ2F; 489 | INFOPLIST_FILE = localizationDemo/Info.plist; 490 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 491 | PRODUCT_BUNDLE_IDENTIFIER = com.webmyne.localizationDemo; 492 | PRODUCT_NAME = "$(TARGET_NAME)"; 493 | SWIFT_OBJC_BRIDGING_HEADER = "$(inherited)"; 494 | SWIFT_VERSION = 3.0; 495 | }; 496 | name = Release; 497 | }; 498 | 8F99CC591F6A48E2003F947F /* Debug */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 502 | BUNDLE_LOADER = "$(TEST_HOST)"; 503 | DEVELOPMENT_TEAM = 4NS8D3NZ2F; 504 | INFOPLIST_FILE = localizationDemoTests/Info.plist; 505 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 506 | PRODUCT_BUNDLE_IDENTIFIER = com.webmyne.localizationDemoTests; 507 | PRODUCT_NAME = "$(TARGET_NAME)"; 508 | SWIFT_VERSION = 3.0; 509 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/localizationDemo.app/localizationDemo"; 510 | }; 511 | name = Debug; 512 | }; 513 | 8F99CC5A1F6A48E2003F947F /* Release */ = { 514 | isa = XCBuildConfiguration; 515 | buildSettings = { 516 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 517 | BUNDLE_LOADER = "$(TEST_HOST)"; 518 | DEVELOPMENT_TEAM = 4NS8D3NZ2F; 519 | INFOPLIST_FILE = localizationDemoTests/Info.plist; 520 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 521 | PRODUCT_BUNDLE_IDENTIFIER = com.webmyne.localizationDemoTests; 522 | PRODUCT_NAME = "$(TARGET_NAME)"; 523 | SWIFT_VERSION = 3.0; 524 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/localizationDemo.app/localizationDemo"; 525 | }; 526 | name = Release; 527 | }; 528 | 8F99CC5C1F6A48E2003F947F /* Debug */ = { 529 | isa = XCBuildConfiguration; 530 | buildSettings = { 531 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 532 | DEVELOPMENT_TEAM = 4NS8D3NZ2F; 533 | INFOPLIST_FILE = localizationDemoUITests/Info.plist; 534 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 535 | PRODUCT_BUNDLE_IDENTIFIER = com.webmyne.localizationDemoUITests; 536 | PRODUCT_NAME = "$(TARGET_NAME)"; 537 | SWIFT_VERSION = 3.0; 538 | TEST_TARGET_NAME = localizationDemo; 539 | }; 540 | name = Debug; 541 | }; 542 | 8F99CC5D1F6A48E2003F947F /* Release */ = { 543 | isa = XCBuildConfiguration; 544 | buildSettings = { 545 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 546 | DEVELOPMENT_TEAM = 4NS8D3NZ2F; 547 | INFOPLIST_FILE = localizationDemoUITests/Info.plist; 548 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 549 | PRODUCT_BUNDLE_IDENTIFIER = com.webmyne.localizationDemoUITests; 550 | PRODUCT_NAME = "$(TARGET_NAME)"; 551 | SWIFT_VERSION = 3.0; 552 | TEST_TARGET_NAME = localizationDemo; 553 | }; 554 | name = Release; 555 | }; 556 | /* End XCBuildConfiguration section */ 557 | 558 | /* Begin XCConfigurationList section */ 559 | 8F99CC281F6A48E1003F947F /* Build configuration list for PBXProject "localizationDemo" */ = { 560 | isa = XCConfigurationList; 561 | buildConfigurations = ( 562 | 8F99CC531F6A48E2003F947F /* Debug */, 563 | 8F99CC541F6A48E2003F947F /* Release */, 564 | ); 565 | defaultConfigurationIsVisible = 0; 566 | defaultConfigurationName = Release; 567 | }; 568 | 8F99CC551F6A48E2003F947F /* Build configuration list for PBXNativeTarget "localizationDemo" */ = { 569 | isa = XCConfigurationList; 570 | buildConfigurations = ( 571 | 8F99CC561F6A48E2003F947F /* Debug */, 572 | 8F99CC571F6A48E2003F947F /* Release */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | defaultConfigurationName = Release; 576 | }; 577 | 8F99CC581F6A48E2003F947F /* Build configuration list for PBXNativeTarget "localizationDemoTests" */ = { 578 | isa = XCConfigurationList; 579 | buildConfigurations = ( 580 | 8F99CC591F6A48E2003F947F /* Debug */, 581 | 8F99CC5A1F6A48E2003F947F /* Release */, 582 | ); 583 | defaultConfigurationIsVisible = 0; 584 | defaultConfigurationName = Release; 585 | }; 586 | 8F99CC5B1F6A48E2003F947F /* Build configuration list for PBXNativeTarget "localizationDemoUITests" */ = { 587 | isa = XCConfigurationList; 588 | buildConfigurations = ( 589 | 8F99CC5C1F6A48E2003F947F /* Debug */, 590 | 8F99CC5D1F6A48E2003F947F /* Release */, 591 | ); 592 | defaultConfigurationIsVisible = 0; 593 | defaultConfigurationName = Release; 594 | }; 595 | /* End XCConfigurationList section */ 596 | }; 597 | rootObject = 8F99CC251F6A48E1003F947F /* Project object */; 598 | } 599 | -------------------------------------------------------------------------------- /localizationDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /localizationDemo.xcodeproj/xcuserdata/prashant.xcuserdatad/xcschemes/localizationDemo.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 | -------------------------------------------------------------------------------- /localizationDemo.xcodeproj/xcuserdata/prashant.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | localizationDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8F99CC2C1F6A48E1003F947F 16 | 17 | primary 18 | 19 | 20 | 8F99CC401F6A48E2003F947F 21 | 22 | primary 23 | 24 | 25 | 8F99CC4B1F6A48E2003F947F 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /localizationDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // localizationDemo 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | PPLocalization.sharedInstance.setLanguage(language: "en") 19 | 20 | // print("$(inherited)") 21 | 22 | return true 23 | } 24 | 25 | func applicationWillResignActive(_ application: UIApplication) { 26 | // 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. 27 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 28 | } 29 | 30 | func applicationDidEnterBackground(_ application: UIApplication) { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | func applicationWillEnterForeground(_ application: UIApplication) { 36 | // 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. 37 | } 38 | 39 | func applicationDidBecomeActive(_ application: UIApplication) { 40 | // 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. 41 | } 42 | 43 | func applicationWillTerminate(_ application: UIApplication) { 44 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 45 | } 46 | 47 | func initrootView(){ 48 | let storyboard = UIStoryboard(name: "Main", bundle: nil) 49 | let lvc: MainTabBarController? = storyboard.instantiateViewController(withIdentifier: "MainTabBarController") as? MainTabBarController 50 | let navigation = UINavigationController(rootViewController: lvc!) 51 | 52 | let dir = PPLocalization().getlanguageDirection() 53 | if dir == .leftToRight { 54 | let semantic: UISemanticContentAttribute = .forceLeftToRight 55 | UITabBar.appearance().semanticContentAttribute = semantic 56 | UIView.appearance().semanticContentAttribute = semantic 57 | UINavigationBar.appearance().semanticContentAttribute = semantic 58 | navigation.navigationBar.semanticContentAttribute = semantic 59 | } 60 | else { 61 | let semantic: UISemanticContentAttribute = .forceRightToLeft 62 | UITabBar.appearance().semanticContentAttribute = semantic 63 | UIView.appearance().semanticContentAttribute = semantic 64 | UINavigationBar.appearance().semanticContentAttribute = semantic 65 | navigation.navigationBar.semanticContentAttribute = semantic 66 | } 67 | 68 | navigation.navigationBar.isHidden = false 69 | window?.rootViewController = navigation 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /localizationDemo/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 | } -------------------------------------------------------------------------------- /localizationDemo/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 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /localizationDemo/Base.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | localizationDemo 4 | 5 | Created by Prashant Prajapati on 14/09/17. 6 | Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | */ 8 | "next" = "next"; 9 | "hello" = "hello"; 10 | -------------------------------------------------------------------------------- /localizationDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | 86 | 92 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /localizationDemo/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /localizationDemo/Item1ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Item1ViewController.swift 3 | // localizationDemo 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class Item1ViewController: UIViewController { 12 | let appDelegate = UIApplication.shared.delegate as! AppDelegate 13 | @IBOutlet weak var lblTitle: UILabel! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | // Do any additional setup after loading the view. 18 | } 19 | 20 | override func didReceiveMemoryWarning() { 21 | super.didReceiveMemoryWarning() 22 | // Dispose of any resources that can be recreated. 23 | } 24 | 25 | @IBAction func actionArabic(_ sender: Any) { 26 | PPLocalization.sharedInstance.setLanguage(language: "ar") 27 | // let semantic: UISemanticContentAttribute = .forceRightToLeft 28 | // // sender.isOn ? .forceRightToLeft : .forceLeftToRight 29 | // UITabBar.appearance().semanticContentAttribute = semantic 30 | // UIView.appearance().semanticContentAttribute = semantic 31 | // UINavigationBar.appearance().semanticContentAttribute = semantic 32 | appDelegate.initrootView() 33 | } 34 | 35 | @IBAction func actionenglish(_ sender: Any) { 36 | PPLocalization.sharedInstance.setLanguage(language: "en") 37 | // let semantic: UISemanticContentAttribute = .forceLeftToRight 38 | // // sender.isOn ? .forceRightToLeft : .forceLeftToRight 39 | // PPLocalization.sharedInstance.setLanguage(language: "en") 40 | // 41 | // UIView.appearance().semanticContentAttribute = semantic 42 | // UITabBar.appearance().semanticContentAttribute = semantic 43 | // UINavigationBar.appearance().semanticContentAttribute = semantic 44 | appDelegate.initrootView() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /localizationDemo/Item2ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Item2ViewController.swift 3 | // localizationDemo 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class Item2ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | // Do any additional setup after loading the view. 17 | } 18 | 19 | override func didReceiveMemoryWarning() { 20 | super.didReceiveMemoryWarning() 21 | // Dispose of any resources that can be recreated. 22 | } 23 | 24 | /* 25 | // MARK: - Navigation 26 | 27 | // In a storyboard-based application, you will often want to do a little preparation before navigation 28 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 29 | // Get the new view controller using segue.destinationViewController. 30 | // Pass the selected object to the new view controller. 31 | } 32 | */ 33 | 34 | } 35 | -------------------------------------------------------------------------------- /localizationDemo/LanguageUtilities/DT_Icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Prashant961992/localization_Swift/170df98dd2b31f4a1fc582701db9a5e3182cf448/localizationDemo/LanguageUtilities/DT_Icons.png -------------------------------------------------------------------------------- /localizationDemo/LanguageUtilities/PPButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PPButton.swift 3 | // localizationDemo 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class PPButton: UIButton { 12 | 13 | override func awakeFromNib() { 14 | super.awakeFromNib() 15 | self.setTitle(PPLocalizedString(key: self.titleLabel?.text as Any, comment: "") as? String, for: .normal) 16 | self.initialization() 17 | } 18 | 19 | func initialization() { 20 | let dir = PPLocalization().getlanguageDirection() 21 | if dir == .leftToRight { 22 | semanticContentAttribute = .forceLeftToRight 23 | imageView?.transform = CGAffineTransform(rotationAngle: CGFloat(Double.pi / 2 * 2)) 24 | } 25 | else { 26 | semanticContentAttribute = .forceRightToLeft 27 | imageView?.transform = CGAffineTransform(rotationAngle: CGFloat(Double.pi / 2 * 2)) 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /localizationDemo/LanguageUtilities/PPLabel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PPLabel.swift 3 | // localizationDemo 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class PPLabel: UILabel { 12 | required init?(coder aDecoder: NSCoder) { 13 | super.init(coder: aDecoder) 14 | 15 | // if ([ApplicationData sharedInstance].language == 0) { 16 | // self.textAlignment = NSTextAlignmentLeft; 17 | // } else { 18 | // self.textAlignment = NSTextAlignmentRight; 19 | // } 20 | text = PPLocalizedString(key: text as Any, comment: "") as? String 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /localizationDemo/LanguageUtilities/PPLocalization.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PPLocalization.swift 3 | // localizationDemo 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | enum LanguageDirection : Int { 12 | case leftToRight = 1 13 | case rightToLeft = 2 14 | } 15 | 16 | class PPLocalization: NSObject { 17 | static let sharedInstance = PPLocalization() 18 | private var bundle: Bundle? = nil 19 | var languageDirection = LanguageDirection(rawValue: 1) 20 | 21 | func getlanguageDirection() -> LanguageDirection { 22 | if languageDirection?.rawValue == 0 { 23 | return .leftToRight 24 | }else if getLanguage() == "ar" { 25 | return .rightToLeft 26 | }else{ 27 | return .leftToRight 28 | } 29 | } 30 | 31 | func localizedString(forKey key: String, value comment: String) -> String { 32 | return bundle!.localizedString(forKey: key, value: comment, table: nil) 33 | } 34 | 35 | func setLanguage(language: String) -> Void { 36 | var l = language as String; 37 | 38 | if l.characters.count == 0 { 39 | l = "en" 40 | } 41 | UserDefaults.standard.set(l, forKey: "kLanguage") 42 | UserDefaults.standard.synchronize() 43 | let path: String? = Bundle.main.path(forResource: l, ofType: "lproj") 44 | if path == nil { 45 | //in case the language does not exists 46 | resetLocalization() 47 | } 48 | else { 49 | bundle = Bundle(path: path!) 50 | } 51 | } 52 | 53 | func resetLocalization() { 54 | bundle = Bundle.main 55 | } 56 | 57 | func getLanguage() -> String { 58 | var lang: String? = UserDefaults.standard.string(forKey: "kLanguage") 59 | if (lang?.characters.count ?? 0) == 0 { 60 | lang = "en" 61 | } 62 | return lang! 63 | } 64 | 65 | func languageSelectedString(forKey key: String) -> String { 66 | var path: String 67 | if (getLanguage() == "en") { 68 | path = Bundle.main.path(forResource: "en", ofType: "lproj")! 69 | } 70 | else if (getLanguage() == "hi") { 71 | path = Bundle.main.path(forResource: "hi", ofType: "lproj")! 72 | } 73 | else if (getLanguage() == "ko") { 74 | path = Bundle.main.path(forResource: "ko", ofType: "lproj")! 75 | } 76 | else if (getLanguage() == "zh-Hans") { 77 | path = Bundle.main.path(forResource: "zh-Hans", ofType: "lproj")! 78 | } 79 | else if (getLanguage() == "ar-BH") { 80 | path = Bundle.main.path(forResource: "ar-BH", ofType: "lproj")! 81 | }else if (getLanguage() == "ar") { 82 | path = Bundle.main.path(forResource: "ar", ofType: "lproj")! 83 | } 84 | else { 85 | path = Bundle.main.path(forResource: "en", ofType: "lproj")! 86 | } 87 | 88 | let languageBundle = Bundle(path: path) 89 | let str = languageBundle?.localizedString(forKey: key, value: "", table: nil) 90 | 91 | return str! 92 | } 93 | } 94 | 95 | func PPLocalizedString(key: Any, comment: Any) -> Any { 96 | return PPLocalization.sharedInstance.localizedString(forKey: (key as! String), value: (comment as! String)) 97 | } 98 | 99 | 100 | -------------------------------------------------------------------------------- /localizationDemo/MainTabBarController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainTabBarController.swift 3 | // localizationDemo 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MainTabBarController: UITabBarController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | // Do any additional setup after loading the view. 17 | } 18 | 19 | override func didReceiveMemoryWarning() { 20 | super.didReceiveMemoryWarning() 21 | // Dispose of any resources that can be recreated. 22 | } 23 | 24 | 25 | /* 26 | // MARK: - Navigation 27 | 28 | // In a storyboard-based application, you will often want to do a little preparation before navigation 29 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 30 | // Get the new view controller using segue.destinationViewController. 31 | // Pass the selected object to the new view controller. 32 | } 33 | */ 34 | 35 | } 36 | -------------------------------------------------------------------------------- /localizationDemo/ar.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | localizationDemo 4 | 5 | Created by Prashant Prajapati on 14/09/17. 6 | Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | */ 8 | "next" = "التالي"; 9 | "hello" = "هالة"; 10 | -------------------------------------------------------------------------------- /localizationDemo/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | localizationDemo 4 | 5 | Created by Prashant Prajapati on 14/09/17. 6 | Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | */ 8 | "next" = "next"; 9 | "hello" = "hello"; 10 | -------------------------------------------------------------------------------- /localizationDemo/localizationDemo-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // localizationDemo-Bridging-Header.h 3 | // localizationDemo 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | #ifndef localizationDemo_Bridging_Header_h 10 | #define localizationDemo_Bridging_Header_h 11 | 12 | //#import "LocalizationSystem.h" 13 | 14 | #endif /* localizationDemo_Bridging_Header_h */ 15 | -------------------------------------------------------------------------------- /localizationDemoTests/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 | -------------------------------------------------------------------------------- /localizationDemoTests/localizationDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // localizationDemoTests.swift 3 | // localizationDemoTests 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import localizationDemo 11 | 12 | class localizationDemoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /localizationDemoUITests/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 | -------------------------------------------------------------------------------- /localizationDemoUITests/localizationDemoUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // localizationDemoUITests.swift 3 | // localizationDemoUITests 4 | // 5 | // Created by Prashant Prajapati on 14/09/17. 6 | // Copyright © 2017 Prashant Prajapati. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class localizationDemoUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // 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. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------