Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added Localization Unit Test

  • Loading branch information...
commit e114d1944092e8b4f2dda4b4771c104d933da032 1 parent a44149f
Oliver Drobnik authored
3  .gitmodules
@@ -4,3 +4,6 @@
4 4 [submodule "Externals/DTBonjour"]
5 5 path = Externals/DTBonjour
6 6 url = https://github.com/Cocoanetics/DTBonjour.git
  7 +[submodule "Externals/DTLocalizableStringScanner"]
  8 + path = Externals/DTLocalizableStringScanner
  9 + url = git@github.com:Cocoanetics/DTLocalizableStringScanner.git
1  Externals/DTLocalizableStringScanner
... ... @@ -0,0 +1 @@
  1 +Subproject commit 67e9c49b4abe89aa814b701e4c3e99bab75a5e74
248 LocalizationDemo/LocalizationDemo.xcodeproj/project.pbxproj
@@ -18,8 +18,37 @@
18 18 A7B5B21016F88DA20078E1C1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B5B20F16F88DA20078E1C1 /* ViewController.m */; };
19 19 A7B5B21316F88DA20078E1C1 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A7B5B21116F88DA20078E1C1 /* ViewController.xib */; };
20 20 A7B5B21B16F88DC80078E1C1 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A7B5B21D16F88DC80078E1C1 /* Localizable.strings */; };
  21 + A7B5B23A16F899AC0078E1C1 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7B5B23916F899AC0078E1C1 /* SenTestingKit.framework */; };
  22 + A7B5B23C16F899AC0078E1C1 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7B5B23B16F899AC0078E1C1 /* Cocoa.framework */; };
  23 + A7B5B24616F899AC0078E1C1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A7B5B24416F899AC0078E1C1 /* InfoPlist.strings */; };
  24 + A7B5B24916F899AC0078E1C1 /* LocalizationUnitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B5B24816F899AC0078E1C1 /* LocalizationUnitTest.m */; };
  25 + A7B5B26F16F8A5980078E1C1 /* libDTLocalizableStringScanner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A7B5B26C16F8A5430078E1C1 /* libDTLocalizableStringScanner.a */; };
21 26 /* End PBXBuildFile section */
22 27
  28 +/* Begin PBXContainerItemProxy section */
  29 + A7B5B26916F8A5430078E1C1 /* PBXContainerItemProxy */ = {
  30 + isa = PBXContainerItemProxy;
  31 + containerPortal = A7B5B26216F8A5430078E1C1 /* genstrings2.xcodeproj */;
  32 + proxyType = 2;
  33 + remoteGlobalIDString = A775233D14ACEF7A0035CDCA;
  34 + remoteInfo = "Command Line Tool";
  35 + };
  36 + A7B5B26B16F8A5430078E1C1 /* PBXContainerItemProxy */ = {
  37 + isa = PBXContainerItemProxy;
  38 + containerPortal = A7B5B26216F8A5430078E1C1 /* genstrings2.xcodeproj */;
  39 + proxyType = 2;
  40 + remoteGlobalIDString = A79AC08814B1A51800489FA3;
  41 + remoteInfo = "Static Library";
  42 + };
  43 + A7B5B26D16F8A5430078E1C1 /* PBXContainerItemProxy */ = {
  44 + isa = PBXContainerItemProxy;
  45 + containerPortal = A7B5B26216F8A5430078E1C1 /* genstrings2.xcodeproj */;
  46 + proxyType = 2;
  47 + remoteGlobalIDString = A7F65DBE14C03E980092E2EE;
  48 + remoteInfo = UnitTest;
  49 + };
  50 +/* End PBXContainerItemProxy section */
  51 +
23 52 /* Begin PBXFileReference section */
24 53 A7B5B1F316F88DA20078E1C1 /* LocalizationDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LocalizationDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
25 54 A7B5B1F616F88DA20078E1C1 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
@@ -36,9 +65,21 @@
36 65 A7B5B20E16F88DA20078E1C1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
37 66 A7B5B20F16F88DA20078E1C1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
38 67 A7B5B21216F88DA20078E1C1 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = "<group>"; };
39   - A7B5B21C16F88DC80078E1C1 /* en */ = {isa = PBXFileReference; lastKnownFileType = file; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
  68 + A7B5B21C16F88DC80078E1C1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
40 69 A7B5B21E16F88DD80078E1C1 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/ViewController.xib; sourceTree = "<group>"; };
41   - A7B5B22016F88DD80078E1C1 /* de */ = {isa = PBXFileReference; lastKnownFileType = file; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
  70 + A7B5B22016F88DD80078E1C1 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
  71 + A7B5B23816F899AB0078E1C1 /* LocalizationUnitTest.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocalizationUnitTest.octest; sourceTree = BUILT_PRODUCTS_DIR; };
  72 + A7B5B23916F899AC0078E1C1 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
  73 + A7B5B23B16F899AC0078E1C1 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; };
  74 + A7B5B23E16F899AC0078E1C1 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
  75 + A7B5B23F16F899AC0078E1C1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
  76 + A7B5B24016F899AC0078E1C1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
  77 + A7B5B24316F899AC0078E1C1 /* LocalizationUnitTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LocalizationUnitTest-Info.plist"; sourceTree = "<group>"; };
  78 + A7B5B24516F899AC0078E1C1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
  79 + A7B5B24716F899AC0078E1C1 /* LocalizationUnitTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalizationUnitTest.h; sourceTree = "<group>"; };
  80 + A7B5B24816F899AC0078E1C1 /* LocalizationUnitTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalizationUnitTest.m; sourceTree = "<group>"; };
  81 + A7B5B24A16F899AC0078E1C1 /* LocalizationUnitTest-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "LocalizationUnitTest-Prefix.pch"; sourceTree = "<group>"; };
  82 + A7B5B26216F8A5430078E1C1 /* genstrings2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = genstrings2.xcodeproj; path = ../../Externals/DTLocalizableStringScanner/genstrings2.xcodeproj; sourceTree = "<group>"; };
42 83 /* End PBXFileReference section */
43 84
44 85 /* Begin PBXFrameworksBuildPhase section */
@@ -52,6 +93,16 @@
52 93 );
53 94 runOnlyForDeploymentPostprocessing = 0;
54 95 };
  96 + A7B5B23416F899AB0078E1C1 /* Frameworks */ = {
  97 + isa = PBXFrameworksBuildPhase;
  98 + buildActionMask = 2147483647;
  99 + files = (
  100 + A7B5B26F16F8A5980078E1C1 /* libDTLocalizableStringScanner.a in Frameworks */,
  101 + A7B5B23A16F899AC0078E1C1 /* SenTestingKit.framework in Frameworks */,
  102 + A7B5B23C16F899AC0078E1C1 /* Cocoa.framework in Frameworks */,
  103 + );
  104 + runOnlyForDeploymentPostprocessing = 0;
  105 + };
55 106 /* End PBXFrameworksBuildPhase section */
56 107
57 108 /* Begin PBXGroup section */
@@ -59,6 +110,7 @@
59 110 isa = PBXGroup;
60 111 children = (
61 112 A7B5B1FC16F88DA20078E1C1 /* LocalizationDemo */,
  113 + A7B5B24116F899AC0078E1C1 /* LocalizationUnitTest */,
62 114 A7B5B1F516F88DA20078E1C1 /* Frameworks */,
63 115 A7B5B1F416F88DA20078E1C1 /* Products */,
64 116 );
@@ -68,6 +120,7 @@
68 120 isa = PBXGroup;
69 121 children = (
70 122 A7B5B1F316F88DA20078E1C1 /* LocalizationDemo.app */,
  123 + A7B5B23816F899AB0078E1C1 /* LocalizationUnitTest.octest */,
71 124 );
72 125 name = Products;
73 126 sourceTree = "<group>";
@@ -78,6 +131,9 @@
78 131 A7B5B1F616F88DA20078E1C1 /* UIKit.framework */,
79 132 A7B5B1F816F88DA20078E1C1 /* Foundation.framework */,
80 133 A7B5B1FA16F88DA20078E1C1 /* CoreGraphics.framework */,
  134 + A7B5B23916F899AC0078E1C1 /* SenTestingKit.framework */,
  135 + A7B5B23B16F899AC0078E1C1 /* Cocoa.framework */,
  136 + A7B5B23D16F899AC0078E1C1 /* Other Frameworks */,
81 137 );
82 138 name = Frameworks;
83 139 sourceTree = "<group>";
@@ -109,6 +165,55 @@
109 165 name = "Supporting Files";
110 166 sourceTree = "<group>";
111 167 };
  168 + A7B5B23D16F899AC0078E1C1 /* Other Frameworks */ = {
  169 + isa = PBXGroup;
  170 + children = (
  171 + A7B5B23E16F899AC0078E1C1 /* AppKit.framework */,
  172 + A7B5B23F16F899AC0078E1C1 /* CoreData.framework */,
  173 + A7B5B24016F899AC0078E1C1 /* Foundation.framework */,
  174 + );
  175 + name = "Other Frameworks";
  176 + sourceTree = "<group>";
  177 + };
  178 + A7B5B24116F899AC0078E1C1 /* LocalizationUnitTest */ = {
  179 + isa = PBXGroup;
  180 + children = (
  181 + A7B5B26116F8A4E60078E1C1 /* Externals */,
  182 + A7B5B24716F899AC0078E1C1 /* LocalizationUnitTest.h */,
  183 + A7B5B24816F899AC0078E1C1 /* LocalizationUnitTest.m */,
  184 + A7B5B24216F899AC0078E1C1 /* Supporting Files */,
  185 + );
  186 + path = LocalizationUnitTest;
  187 + sourceTree = "<group>";
  188 + };
  189 + A7B5B24216F899AC0078E1C1 /* Supporting Files */ = {
  190 + isa = PBXGroup;
  191 + children = (
  192 + A7B5B24316F899AC0078E1C1 /* LocalizationUnitTest-Info.plist */,
  193 + A7B5B24416F899AC0078E1C1 /* InfoPlist.strings */,
  194 + A7B5B24A16F899AC0078E1C1 /* LocalizationUnitTest-Prefix.pch */,
  195 + );
  196 + name = "Supporting Files";
  197 + sourceTree = "<group>";
  198 + };
  199 + A7B5B26116F8A4E60078E1C1 /* Externals */ = {
  200 + isa = PBXGroup;
  201 + children = (
  202 + A7B5B26216F8A5430078E1C1 /* genstrings2.xcodeproj */,
  203 + );
  204 + name = Externals;
  205 + sourceTree = "<group>";
  206 + };
  207 + A7B5B26316F8A5430078E1C1 /* Products */ = {
  208 + isa = PBXGroup;
  209 + children = (
  210 + A7B5B26A16F8A5430078E1C1 /* genstrings2 */,
  211 + A7B5B26C16F8A5430078E1C1 /* libDTLocalizableStringScanner.a */,
  212 + A7B5B26E16F8A5430078E1C1 /* UnitTest.octest */,
  213 + );
  214 + name = Products;
  215 + sourceTree = "<group>";
  216 + };
112 217 /* End PBXGroup section */
113 218
114 219 /* Begin PBXNativeTarget section */
@@ -129,6 +234,24 @@
129 234 productReference = A7B5B1F316F88DA20078E1C1 /* LocalizationDemo.app */;
130 235 productType = "com.apple.product-type.application";
131 236 };
  237 + A7B5B23716F899AB0078E1C1 /* LocalizationUnitTest */ = {
  238 + isa = PBXNativeTarget;
  239 + buildConfigurationList = A7B5B24D16F899AC0078E1C1 /* Build configuration list for PBXNativeTarget "LocalizationUnitTest" */;
  240 + buildPhases = (
  241 + A7B5B23316F899AB0078E1C1 /* Sources */,
  242 + A7B5B23416F899AB0078E1C1 /* Frameworks */,
  243 + A7B5B23516F899AB0078E1C1 /* Resources */,
  244 + A7B5B23616F899AB0078E1C1 /* ShellScript */,
  245 + );
  246 + buildRules = (
  247 + );
  248 + dependencies = (
  249 + );
  250 + name = LocalizationUnitTest;
  251 + productName = LocalizationUnitTest;
  252 + productReference = A7B5B23816F899AB0078E1C1 /* LocalizationUnitTest.octest */;
  253 + productType = "com.apple.product-type.bundle";
  254 + };
132 255 /* End PBXNativeTarget section */
133 256
134 257 /* Begin PBXProject section */
@@ -149,13 +272,44 @@
149 272 mainGroup = A7B5B1EA16F88DA20078E1C1;
150 273 productRefGroup = A7B5B1F416F88DA20078E1C1 /* Products */;
151 274 projectDirPath = "";
  275 + projectReferences = (
  276 + {
  277 + ProductGroup = A7B5B26316F8A5430078E1C1 /* Products */;
  278 + ProjectRef = A7B5B26216F8A5430078E1C1 /* genstrings2.xcodeproj */;
  279 + },
  280 + );
152 281 projectRoot = "";
153 282 targets = (
154 283 A7B5B1F216F88DA20078E1C1 /* LocalizationDemo */,
  284 + A7B5B23716F899AB0078E1C1 /* LocalizationUnitTest */,
155 285 );
156 286 };
157 287 /* End PBXProject section */
158 288
  289 +/* Begin PBXReferenceProxy section */
  290 + A7B5B26A16F8A5430078E1C1 /* genstrings2 */ = {
  291 + isa = PBXReferenceProxy;
  292 + fileType = "compiled.mach-o.executable";
  293 + path = genstrings2;
  294 + remoteRef = A7B5B26916F8A5430078E1C1 /* PBXContainerItemProxy */;
  295 + sourceTree = BUILT_PRODUCTS_DIR;
  296 + };
  297 + A7B5B26C16F8A5430078E1C1 /* libDTLocalizableStringScanner.a */ = {
  298 + isa = PBXReferenceProxy;
  299 + fileType = archive.ar;
  300 + path = libDTLocalizableStringScanner.a;
  301 + remoteRef = A7B5B26B16F8A5430078E1C1 /* PBXContainerItemProxy */;
  302 + sourceTree = BUILT_PRODUCTS_DIR;
  303 + };
  304 + A7B5B26E16F8A5430078E1C1 /* UnitTest.octest */ = {
  305 + isa = PBXReferenceProxy;
  306 + fileType = wrapper.cfbundle;
  307 + path = UnitTest.octest;
  308 + remoteRef = A7B5B26D16F8A5430078E1C1 /* PBXContainerItemProxy */;
  309 + sourceTree = BUILT_PRODUCTS_DIR;
  310 + };
  311 +/* End PBXReferenceProxy section */
  312 +
159 313 /* Begin PBXResourcesBuildPhase section */
160 314 A7B5B1F116F88DA20078E1C1 /* Resources */ = {
161 315 isa = PBXResourcesBuildPhase;
@@ -169,8 +323,32 @@
169 323 );
170 324 runOnlyForDeploymentPostprocessing = 0;
171 325 };
  326 + A7B5B23516F899AB0078E1C1 /* Resources */ = {
  327 + isa = PBXResourcesBuildPhase;
  328 + buildActionMask = 2147483647;
  329 + files = (
  330 + A7B5B24616F899AC0078E1C1 /* InfoPlist.strings in Resources */,
  331 + );
  332 + runOnlyForDeploymentPostprocessing = 0;
  333 + };
172 334 /* End PBXResourcesBuildPhase section */
173 335
  336 +/* Begin PBXShellScriptBuildPhase section */
  337 + A7B5B23616F899AB0078E1C1 /* ShellScript */ = {
  338 + isa = PBXShellScriptBuildPhase;
  339 + buildActionMask = 2147483647;
  340 + files = (
  341 + );
  342 + inputPaths = (
  343 + );
  344 + outputPaths = (
  345 + );
  346 + runOnlyForDeploymentPostprocessing = 0;
  347 + shellPath = /bin/sh;
  348 + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
  349 + };
  350 +/* End PBXShellScriptBuildPhase section */
  351 +
174 352 /* Begin PBXSourcesBuildPhase section */
175 353 A7B5B1EF16F88DA20078E1C1 /* Sources */ = {
176 354 isa = PBXSourcesBuildPhase;
@@ -182,6 +360,14 @@
182 360 );
183 361 runOnlyForDeploymentPostprocessing = 0;
184 362 };
  363 + A7B5B23316F899AB0078E1C1 /* Sources */ = {
  364 + isa = PBXSourcesBuildPhase;
  365 + buildActionMask = 2147483647;
  366 + files = (
  367 + A7B5B24916F899AC0078E1C1 /* LocalizationUnitTest.m in Sources */,
  368 + );
  369 + runOnlyForDeploymentPostprocessing = 0;
  370 + };
185 371 /* End PBXSourcesBuildPhase section */
186 372
187 373 /* Begin PBXVariantGroup section */
@@ -203,6 +389,14 @@
203 389 name = Localizable.strings;
204 390 sourceTree = "<group>";
205 391 };
  392 + A7B5B24416F899AC0078E1C1 /* InfoPlist.strings */ = {
  393 + isa = PBXVariantGroup;
  394 + children = (
  395 + A7B5B24516F899AC0078E1C1 /* en */,
  396 + );
  397 + name = InfoPlist.strings;
  398 + sourceTree = "<group>";
  399 + };
206 400 /* End PBXVariantGroup section */
207 401
208 402 /* Begin XCBuildConfiguration section */
@@ -284,6 +478,47 @@
284 478 };
285 479 name = Release;
286 480 };
  481 + A7B5B24B16F899AC0078E1C1 /* Debug */ = {
  482 + isa = XCBuildConfiguration;
  483 + buildSettings = {
  484 + ARCHS = "$(ARCHS_STANDARD_64_BIT)";
  485 + COMBINE_HIDPI_IMAGES = YES;
  486 + FRAMEWORK_SEARCH_PATHS = "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"";
  487 + GCC_ENABLE_OBJC_EXCEPTIONS = YES;
  488 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  489 + GCC_PREFIX_HEADER = "LocalizationUnitTest/LocalizationUnitTest-Prefix.pch";
  490 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  491 + INFOPLIST_FILE = "LocalizationUnitTest/LocalizationUnitTest-Info.plist";
  492 + MACOSX_DEPLOYMENT_TARGET = 10.8;
  493 + OTHER_LDFLAGS = "-ObjC";
  494 + PRODUCT_NAME = "$(TARGET_NAME)";
  495 + SDKROOT = macosx;
  496 + USER_HEADER_SEARCH_PATHS = "../Externals/DTLocalizableStringScanner/**";
  497 + WRAPPER_EXTENSION = octest;
  498 + };
  499 + name = Debug;
  500 + };
  501 + A7B5B24C16F899AC0078E1C1 /* Release */ = {
  502 + isa = XCBuildConfiguration;
  503 + buildSettings = {
  504 + ARCHS = "$(ARCHS_STANDARD_64_BIT)";
  505 + COMBINE_HIDPI_IMAGES = YES;
  506 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  507 + FRAMEWORK_SEARCH_PATHS = "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"";
  508 + GCC_ENABLE_OBJC_EXCEPTIONS = YES;
  509 + GCC_PRECOMPILE_PREFIX_HEADER = YES;
  510 + GCC_PREFIX_HEADER = "LocalizationUnitTest/LocalizationUnitTest-Prefix.pch";
  511 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  512 + INFOPLIST_FILE = "LocalizationUnitTest/LocalizationUnitTest-Info.plist";
  513 + MACOSX_DEPLOYMENT_TARGET = 10.8;
  514 + OTHER_LDFLAGS = "-ObjC";
  515 + PRODUCT_NAME = "$(TARGET_NAME)";
  516 + SDKROOT = macosx;
  517 + USER_HEADER_SEARCH_PATHS = "../Externals/DTLocalizableStringScanner/**";
  518 + WRAPPER_EXTENSION = octest;
  519 + };
  520 + name = Release;
  521 + };
287 522 /* End XCBuildConfiguration section */
288 523
289 524 /* Begin XCConfigurationList section */
@@ -303,6 +538,15 @@
303 538 A7B5B21816F88DA20078E1C1 /* Release */,
304 539 );
305 540 defaultConfigurationIsVisible = 0;
  541 + defaultConfigurationName = Release;
  542 + };
  543 + A7B5B24D16F899AC0078E1C1 /* Build configuration list for PBXNativeTarget "LocalizationUnitTest" */ = {
  544 + isa = XCConfigurationList;
  545 + buildConfigurations = (
  546 + A7B5B24B16F899AC0078E1C1 /* Debug */,
  547 + A7B5B24C16F899AC0078E1C1 /* Release */,
  548 + );
  549 + defaultConfigurationIsVisible = 0;
306 550 };
307 551 /* End XCConfigurationList section */
308 552 };
22 LocalizationDemo/LocalizationUnitTest/LocalizationUnitTest-Info.plist
... ... @@ -0,0 +1,22 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleDevelopmentRegion</key>
  6 + <string>en</string>
  7 + <key>CFBundleExecutable</key>
  8 + <string>${EXECUTABLE_NAME}</string>
  9 + <key>CFBundleIdentifier</key>
  10 + <string>drobnik.${PRODUCT_NAME:rfc1034identifier}</string>
  11 + <key>CFBundleInfoDictionaryVersion</key>
  12 + <string>6.0</string>
  13 + <key>CFBundlePackageType</key>
  14 + <string>BNDL</string>
  15 + <key>CFBundleShortVersionString</key>
  16 + <string>1.0</string>
  17 + <key>CFBundleSignature</key>
  18 + <string>????</string>
  19 + <key>CFBundleVersion</key>
  20 + <string>1</string>
  21 +</dict>
  22 +</plist>
7 LocalizationDemo/LocalizationUnitTest/LocalizationUnitTest-Prefix.pch
... ... @@ -0,0 +1,7 @@
  1 +//
  2 +// Prefix header for all source files of the 'LocalizationUnitTest' target in the 'LocalizationUnitTest' project
  3 +//
  4 +
  5 +#ifdef __OBJC__
  6 + #import <Cocoa/Cocoa.h>
  7 +#endif
13 LocalizationDemo/LocalizationUnitTest/LocalizationUnitTest.h
... ... @@ -0,0 +1,13 @@
  1 +//
  2 +// LocalizationUnitTest.h
  3 +// LocalizationUnitTest
  4 +//
  5 +// Created by Oliver Drobnik on 19.03.13.
  6 +// Copyright (c) 2013 Drobnik KG. All rights reserved.
  7 +//
  8 +
  9 +#import <SenTestingKit/SenTestingKit.h>
  10 +
  11 +@interface LocalizationUnitTest : SenTestCase
  12 +
  13 +@end
208 LocalizationDemo/LocalizationUnitTest/LocalizationUnitTest.m
... ... @@ -0,0 +1,208 @@
  1 +//
  2 +// LocalizationUnitTest.m
  3 +// LocalizationUnitTest
  4 +//
  5 +// Created by Oliver Drobnik on 19.03.13.
  6 +// Copyright (c) 2013 Drobnik KG. All rights reserved.
  7 +//
  8 +
  9 +#import "LocalizationUnitTest.h"
  10 +
  11 +#import "DTLocalizableStringAggregator.h"
  12 +#import "DTLocalizableStringsParser.h"
  13 +#import "DTLocalizableStringTable.h"
  14 +
  15 +@interface LocalizationUnitTest () <DTLocalizableStringsParserDelegate>
  16 +
  17 +@end
  18 +
  19 +
  20 +@implementation LocalizationUnitTest
  21 +{
  22 + DTLocalizableStringTable *_localizableTable;
  23 +
  24 + NSMutableDictionary *_currentTestedStringFileDictionary;
  25 +}
  26 +
  27 +/**
  28 + Determines the main project path during runtime
  29 + */
  30 +- (NSString *)_projectPath
  31 +{
  32 + NSString *pathOfFolderOfCurrentSourceFile = [[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] stringByDeletingLastPathComponent];
  33 +
  34 + NSString *currentPath = [pathOfFolderOfCurrentSourceFile copy];
  35 +
  36 + BOOL foundIt = NO;
  37 +
  38 + do
  39 + {
  40 + NSString *testPath = [currentPath stringByAppendingPathComponent:@"LocalizationDemo.xcodeproj"];
  41 +
  42 + if ([[NSFileManager defaultManager] fileExistsAtPath:testPath])
  43 + {
  44 + // found it
  45 + foundIt = YES;
  46 + break;
  47 + }
  48 +
  49 + if ([currentPath isEqualToString:@"/"])
  50 + {
  51 + // cannot go further up
  52 + break;
  53 + }
  54 +
  55 + currentPath = [currentPath stringByDeletingLastPathComponent];
  56 + } while ([currentPath length]);
  57 +
  58 +
  59 + if (!foundIt)
  60 + {
  61 + return nil;
  62 + }
  63 +
  64 + return currentPath;
  65 +}
  66 +
  67 +/**
  68 + Creates a list of all source file URLs at this project path
  69 + */
  70 +- (NSArray *)_sourceFilesAtProjectPath:(NSString *)projectPath
  71 +{
  72 +
  73 + NSMutableArray *tmpArray = [NSMutableArray array];
  74 +
  75 + NSArray *keys = @[NSURLIsDirectoryKey];
  76 +
  77 + NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager]
  78 + enumeratorAtURL:[NSURL fileURLWithPath:projectPath]
  79 + includingPropertiesForKeys:keys
  80 + options:(NSDirectoryEnumerationSkipsPackageDescendants
  81 + | NSDirectoryEnumerationSkipsHiddenFiles)
  82 + errorHandler:^(NSURL *url, NSError *error) {
  83 + STFail(@"%@", [error localizedDescription]);
  84 + // Handle the error.
  85 + // Return YES if the enumeration should continue after the error.
  86 + return NO;
  87 + }];
  88 +
  89 + // enumerator goes into depth too!
  90 + for (NSURL *url in enumerator)
  91 + {
  92 + NSNumber *isDirectory = nil;
  93 + [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:NULL];
  94 +
  95 + if (![isDirectory boolValue])
  96 + {
  97 + if ([[[url path] pathExtension] isEqualToString:@"m"])
  98 + {
  99 + [tmpArray addObject:[url path]];
  100 + }
  101 + }
  102 + }
  103 +
  104 + return [tmpArray copy];
  105 +}
  106 +
  107 +/**
  108 + Builds up the string table of entries that require localization
  109 + */
  110 +- (void)_scanSourceCodeFiles:(NSArray *)sourceCodePaths
  111 +{
  112 + // create the aggregator
  113 + DTLocalizableStringAggregator *localizableStringAggregator = [[DTLocalizableStringAggregator alloc] init];
  114 +
  115 + // feed all source files to the aggregator
  116 + for (NSString *oneFile in sourceCodePaths)
  117 + {
  118 + NSURL *URL = [NSURL fileURLWithPath:oneFile];
  119 + [localizableStringAggregator beginProcessingFile:URL];
  120 + }
  121 +
  122 + // wait for completion
  123 + NSArray *stringTables = [localizableStringAggregator aggregatedStringTables];
  124 +
  125 + STAssertTrue([stringTables count]==1, @"Only one string table supported");
  126 +
  127 + _localizableTable = [stringTables lastObject];
  128 +}
  129 +
  130 +
  131 +- (void)setUp
  132 +{
  133 + [super setUp];
  134 +
  135 + // get the project folder
  136 + NSString *projectFolder = [self _projectPath];
  137 +
  138 + // gets file URLs for all the
  139 + NSArray *sourceFiles = [self _sourceFilesAtProjectPath:projectFolder];
  140 +
  141 + // scans the source files and adds the resulting to the string table
  142 + [self _scanSourceCodeFiles:sourceFiles];
  143 +}
  144 +
  145 +- (void)tearDown
  146 +{
  147 + // Tear-down code here.
  148 +
  149 + [super tearDown];
  150 +}
  151 +
  152 +- (void)_testMissingLocalizationsForStringsFileAtPath:(NSString *)path
  153 +{
  154 + // copy the macro strings into a lookup dictionary for this test
  155 + _currentTestedStringFileDictionary = [[NSMutableDictionary alloc] init];
  156 +
  157 + // transfer entries to dictionary
  158 + for (DTLocalizableStringEntry *oneEntry in _localizableTable.entries)
  159 + {
  160 + NSCharacterSet *quoteSet = [NSCharacterSet characterSetWithCharactersInString:@"\""];
  161 + NSString *key = [[oneEntry cleanedKey] stringByTrimmingCharactersInSet:quoteSet];
  162 + NSString *value = [[oneEntry cleanedValue] stringByTrimmingCharactersInSet:quoteSet];
  163 +
  164 + [_currentTestedStringFileDictionary setObject:value forKey:key];
  165 + }
  166 +
  167 + // create URL for Localizable.string to test
  168 + NSURL *stringsFileURL = [NSURL fileURLWithPath:path];
  169 +
  170 + // parse the strings file, this emits a parser:foundKey:value: for each token.
  171 + // These encountered tokens we remove from the dictionary
  172 + DTLocalizableStringsParser *parser = [[DTLocalizableStringsParser alloc] initWithFileURL:stringsFileURL];
  173 + parser.delegate = self;
  174 +
  175 + STAssertTrue([parser parse], @"Failed to parse: %@", parser.parseError);
  176 +
  177 + // any left over tokens are missing localizations
  178 + [_currentTestedStringFileDictionary enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *obj, BOOL *stop) {
  179 + BOOL isNoPlaceholder = ([obj rangeOfString:@"_"].length==0);
  180 + STAssertTrue(isNoPlaceholder, @"Key %@ is not localized and is probably a placeholder", key);
  181 + }];
  182 +}
  183 +
  184 +
  185 +- (void)testGermanStrings
  186 +{
  187 + NSString *stringsPath = [[self _projectPath] stringByAppendingPathComponent:
  188 + @"LocalizationDemo/de.lproj/Localizable.strings"];
  189 +
  190 + [self _testMissingLocalizationsForStringsFileAtPath:stringsPath];
  191 +}
  192 +
  193 +- (void)testEnglishStrings
  194 +{
  195 + NSString *stringsPath = [[self _projectPath] stringByAppendingPathComponent:
  196 + @"LocalizationDemo/en.lproj/Localizable.strings"];
  197 +
  198 + [self _testMissingLocalizationsForStringsFileAtPath:stringsPath];
  199 +}
  200 +
  201 +#pragma mark - DTLocalizableStringsParserDelegate
  202 +
  203 +- (void)parser:(DTLocalizableStringsParser *)parser foundKey:(NSString *)key value:(NSString *)value
  204 +{
  205 + [_currentTestedStringFileDictionary removeObjectForKey:key];
  206 +}
  207 +
  208 +@end
2  LocalizationDemo/LocalizationUnitTest/en.lproj/InfoPlist.strings
... ... @@ -0,0 +1,2 @@
  1 +/* Localized versions of Info.plist keys */
  2 +

0 comments on commit e114d19

Please sign in to comment.
Something went wrong with that request. Please try again.