danger-localizationlinter 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +12 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +167 -0
- data/Guardfile +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +62 -0
- data/Rakefile +25 -0
- data/danger-localizationlinter.gemspec +60 -0
- data/ext/localizationlinter/helper/validate_wording_cli.rb +21 -0
- data/ext/localizationlinter/localizationlinter.rb +331 -0
- data/ext/localizationlinter/swiftgen_localizables_check.stencil +36 -0
- data/lib/danger_localizationlinter.rb +3 -0
- data/lib/danger_plugin.rb +3 -0
- data/lib/localizationlinter/gem_version.rb +5 -0
- data/lib/localizationlinter/plugin.rb +96 -0
- data/spec/Test/Podfile +6 -0
- data/spec/Test/Podfile.lock +16 -0
- data/spec/Test/Pods/SwiftGen/CHANGELOG.md +1357 -0
- data/spec/Test/Pods/SwiftGen/LICENCE +21 -0
- data/spec/Test/Pods/SwiftGen/README.md +892 -0
- data/spec/Test/Pods/SwiftGen/bin/swiftgen +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Commander.framework/Commander +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Commander.framework/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Commander.framework/Versions/A/Commander +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Commander.framework/Versions/A/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Commander.framework/Versions/A/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/Commander.framework/Versions/Current/Commander +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Commander.framework/Versions/Current/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Commander.framework/Versions/Current/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/Kanna.framework/Kanna +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Kanna.framework/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Kanna.framework/Versions/A/Kanna +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Kanna.framework/Versions/A/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Kanna.framework/Versions/A/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/Kanna.framework/Versions/Current/Kanna +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Kanna.framework/Versions/Current/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Kanna.framework/Versions/Current/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/PathKit.framework/PathKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/PathKit.framework/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/PathKit.framework/Versions/A/PathKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/PathKit.framework/Versions/A/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/PathKit.framework/Versions/A/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/PathKit.framework/Versions/Current/PathKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/PathKit.framework/Versions/Current/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/PathKit.framework/Versions/Current/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/Stencil.framework/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Stencil.framework/Stencil +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Stencil.framework/Versions/A/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Stencil.framework/Versions/A/Stencil +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Stencil.framework/Versions/A/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/Stencil.framework/Versions/Current/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Stencil.framework/Versions/Current/Stencil +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Stencil.framework/Versions/Current/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/StencilSwiftKit.framework/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/StencilSwiftKit.framework/StencilSwiftKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/StencilSwiftKit.framework/Versions/A/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/StencilSwiftKit.framework/Versions/A/StencilSwiftKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/StencilSwiftKit.framework/Versions/A/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/StencilSwiftKit.framework/Versions/Current/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/StencilSwiftKit.framework/Versions/Current/StencilSwiftKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/StencilSwiftKit.framework/Versions/Current/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/SwiftGenKit.framework/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/SwiftGenKit.framework/SwiftGenKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/SwiftGenKit.framework/Versions/A/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/SwiftGenKit.framework/Versions/A/SwiftGenKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/SwiftGenKit.framework/Versions/A/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/SwiftGenKit.framework/Versions/Current/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/SwiftGenKit.framework/Versions/Current/SwiftGenKit +0 -0
- data/spec/Test/Pods/SwiftGen/lib/SwiftGenKit.framework/Versions/Current/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/Yams.framework/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Yams.framework/Versions/A/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Yams.framework/Versions/A/Yams +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Yams.framework/Versions/A/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/Yams.framework/Versions/Current/Resources/Info.plist +48 -0
- data/spec/Test/Pods/SwiftGen/lib/Yams.framework/Versions/Current/Yams +0 -0
- data/spec/Test/Pods/SwiftGen/lib/Yams.framework/Versions/Current/_CodeSignature/CodeResources +132 -0
- data/spec/Test/Pods/SwiftGen/lib/Yams.framework/Yams +0 -0
- data/spec/Test/Pods/SwiftGen/templates/colors/literals-swift4.stencil +43 -0
- data/spec/Test/Pods/SwiftGen/templates/colors/literals-swift5.stencil +43 -0
- data/spec/Test/Pods/SwiftGen/templates/colors/swift4.stencil +84 -0
- data/spec/Test/Pods/SwiftGen/templates/colors/swift5.stencil +84 -0
- data/spec/Test/Pods/SwiftGen/templates/coredata/swift4.stencil +211 -0
- data/spec/Test/Pods/SwiftGen/templates/coredata/swift5.stencil +211 -0
- data/spec/Test/Pods/SwiftGen/templates/fonts/swift4.stencil +110 -0
- data/spec/Test/Pods/SwiftGen/templates/fonts/swift5.stencil +113 -0
- data/spec/Test/Pods/SwiftGen/templates/ib/scenes-swift4.stencil +157 -0
- data/spec/Test/Pods/SwiftGen/templates/ib/scenes-swift5.stencil +159 -0
- data/spec/Test/Pods/SwiftGen/templates/ib/segues-swift4.stencil +60 -0
- data/spec/Test/Pods/SwiftGen/templates/ib/segues-swift5.stencil +60 -0
- data/spec/Test/Pods/SwiftGen/templates/json/inline-swift4.stencil +82 -0
- data/spec/Test/Pods/SwiftGen/templates/json/inline-swift5.stencil +82 -0
- data/spec/Test/Pods/SwiftGen/templates/json/runtime-swift4.stencil +112 -0
- data/spec/Test/Pods/SwiftGen/templates/json/runtime-swift5.stencil +112 -0
- data/spec/Test/Pods/SwiftGen/templates/plist/inline-swift4.stencil +82 -0
- data/spec/Test/Pods/SwiftGen/templates/plist/inline-swift5.stencil +82 -0
- data/spec/Test/Pods/SwiftGen/templates/plist/runtime-swift4.stencil +117 -0
- data/spec/Test/Pods/SwiftGen/templates/plist/runtime-swift5.stencil +117 -0
- data/spec/Test/Pods/SwiftGen/templates/strings/flat-swift4.stencil +97 -0
- data/spec/Test/Pods/SwiftGen/templates/strings/flat-swift5.stencil +97 -0
- data/spec/Test/Pods/SwiftGen/templates/strings/objc-h.stencil +66 -0
- data/spec/Test/Pods/SwiftGen/templates/strings/objc-m.stencil +90 -0
- data/spec/Test/Pods/SwiftGen/templates/strings/structured-swift4.stencil +102 -0
- data/spec/Test/Pods/SwiftGen/templates/strings/structured-swift5.stencil +102 -0
- data/spec/Test/Pods/SwiftGen/templates/xcassets/swift4.stencil +266 -0
- data/spec/Test/Pods/SwiftGen/templates/xcassets/swift5.stencil +274 -0
- data/spec/Test/Pods/SwiftGen/templates/yaml/inline-swift4.stencil +92 -0
- data/spec/Test/Pods/SwiftGen/templates/yaml/inline-swift5.stencil +92 -0
- data/spec/Test/Test.xcodeproj/project.pbxproj +406 -0
- data/spec/Test/Test.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/Test/Test.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- data/spec/Test/Test.xcworkspace/contents.xcworkspacedata +10 -0
- data/spec/Test/Test.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- data/spec/Test/Test/AppDelegate.swift +36 -0
- data/spec/Test/Test/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- data/spec/Test/Test/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
- data/spec/Test/Test/Assets.xcassets/Contents.json +6 -0
- data/spec/Test/Test/ContentView.swift +21 -0
- data/spec/Test/Test/Info.plist +62 -0
- data/spec/Test/Test/SceneDelegate.swift +63 -0
- data/spec/Test/Test/all_target_main_language.yml +1 -0
- data/spec/Test/Test/en.lproj/LaunchScreen.storyboard +25 -0
- data/spec/Test/Test/en.lproj/localizable.strings +3 -0
- data/spec/Test/Test/fr.lproj/LaunchScreen.storyboard +25 -0
- data/spec/Test/Test/fr.lproj/localizable.strings +3 -0
- data/spec/localizationofficer_spec.rb +116 -0
- data/spec/spec_helper.rb +67 -0
- data/spec/support/fixtures/all_target_main_language.yml +1 -0
- data/spec/support/fixtures/resources/TEST/en.lproj/Localizable.strings +8 -0
- data/spec/support/fixtures/resources/TEST/en.lproj/Localizable.stringsdict +30 -0
- data/spec/support/fixtures/resources/TEST_KO/en.lproj/Localizable.strings +11 -0
- data/spec/support/fixtures/resources/TEST_KO/en.lproj/Localizable.stringsdict +30 -0
- data/spec/support/fixtures/resources/TEST_KO/fr.lproj/Localizable.strings +11 -0
- data/spec/support/fixtures/resources/TEST_KO/fr.lproj/Localizable.stringsdict +30 -0
- metadata +491 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
//
|
2
|
+
// AppDelegate.swift
|
3
|
+
// Test
|
4
|
+
//
|
5
|
+
// Created by Claire Peyron on 12/04/2021.
|
6
|
+
//
|
7
|
+
|
8
|
+
import UIKit
|
9
|
+
|
10
|
+
@main
|
11
|
+
class AppDelegate: UIResponder, UIApplicationDelegate {
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
16
|
+
// Override point for customization after application launch.
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// MARK: UISceneSession Lifecycle
|
21
|
+
|
22
|
+
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
23
|
+
// Called when a new scene session is being created.
|
24
|
+
// Use this method to select a configuration to create the new scene with.
|
25
|
+
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
26
|
+
}
|
27
|
+
|
28
|
+
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
|
29
|
+
// Called when the user discards a scene session.
|
30
|
+
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
|
31
|
+
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
|
32
|
+
}
|
33
|
+
|
34
|
+
|
35
|
+
}
|
36
|
+
|
@@ -0,0 +1,98 @@
|
|
1
|
+
{
|
2
|
+
"images" : [
|
3
|
+
{
|
4
|
+
"idiom" : "iphone",
|
5
|
+
"scale" : "2x",
|
6
|
+
"size" : "20x20"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"idiom" : "iphone",
|
10
|
+
"scale" : "3x",
|
11
|
+
"size" : "20x20"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"idiom" : "iphone",
|
15
|
+
"scale" : "2x",
|
16
|
+
"size" : "29x29"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"idiom" : "iphone",
|
20
|
+
"scale" : "3x",
|
21
|
+
"size" : "29x29"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"idiom" : "iphone",
|
25
|
+
"scale" : "2x",
|
26
|
+
"size" : "40x40"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"idiom" : "iphone",
|
30
|
+
"scale" : "3x",
|
31
|
+
"size" : "40x40"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"idiom" : "iphone",
|
35
|
+
"scale" : "2x",
|
36
|
+
"size" : "60x60"
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"idiom" : "iphone",
|
40
|
+
"scale" : "3x",
|
41
|
+
"size" : "60x60"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"idiom" : "ipad",
|
45
|
+
"scale" : "1x",
|
46
|
+
"size" : "20x20"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"idiom" : "ipad",
|
50
|
+
"scale" : "2x",
|
51
|
+
"size" : "20x20"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"idiom" : "ipad",
|
55
|
+
"scale" : "1x",
|
56
|
+
"size" : "29x29"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"idiom" : "ipad",
|
60
|
+
"scale" : "2x",
|
61
|
+
"size" : "29x29"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"idiom" : "ipad",
|
65
|
+
"scale" : "1x",
|
66
|
+
"size" : "40x40"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"idiom" : "ipad",
|
70
|
+
"scale" : "2x",
|
71
|
+
"size" : "40x40"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"idiom" : "ipad",
|
75
|
+
"scale" : "1x",
|
76
|
+
"size" : "76x76"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"idiom" : "ipad",
|
80
|
+
"scale" : "2x",
|
81
|
+
"size" : "76x76"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"idiom" : "ipad",
|
85
|
+
"scale" : "2x",
|
86
|
+
"size" : "83.5x83.5"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"idiom" : "ios-marketing",
|
90
|
+
"scale" : "1x",
|
91
|
+
"size" : "1024x1024"
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"info" : {
|
95
|
+
"author" : "xcode",
|
96
|
+
"version" : 1
|
97
|
+
}
|
98
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
//
|
2
|
+
// ContentView.swift
|
3
|
+
// Test
|
4
|
+
//
|
5
|
+
// Created by Claire Peyron on 12/04/2021.
|
6
|
+
//
|
7
|
+
|
8
|
+
import SwiftUI
|
9
|
+
|
10
|
+
struct ContentView: View {
|
11
|
+
var body: some View {
|
12
|
+
Text("Hello, world!")
|
13
|
+
.padding()
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
struct ContentView_Previews: PreviewProvider {
|
18
|
+
static var previews: some View {
|
19
|
+
ContentView()
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,62 @@
|
|
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>$(DEVELOPMENT_LANGUAGE)</string>
|
7
|
+
<key>CFBundleExecutable</key>
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
9
|
+
<key>CFBundleIdentifier</key>
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
12
|
+
<string>6.0</string>
|
13
|
+
<key>CFBundleName</key>
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
15
|
+
<key>CFBundlePackageType</key>
|
16
|
+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
17
|
+
<key>CFBundleShortVersionString</key>
|
18
|
+
<string>1.0</string>
|
19
|
+
<key>CFBundleVersion</key>
|
20
|
+
<string>1</string>
|
21
|
+
<key>LSRequiresIPhoneOS</key>
|
22
|
+
<true/>
|
23
|
+
<key>UIApplicationSceneManifest</key>
|
24
|
+
<dict>
|
25
|
+
<key>UIApplicationSupportsMultipleScenes</key>
|
26
|
+
<false/>
|
27
|
+
<key>UISceneConfigurations</key>
|
28
|
+
<dict>
|
29
|
+
<key>UIWindowSceneSessionRoleApplication</key>
|
30
|
+
<array>
|
31
|
+
<dict>
|
32
|
+
<key>UISceneConfigurationName</key>
|
33
|
+
<string>Default Configuration</string>
|
34
|
+
<key>UISceneDelegateClassName</key>
|
35
|
+
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
36
|
+
</dict>
|
37
|
+
</array>
|
38
|
+
</dict>
|
39
|
+
</dict>
|
40
|
+
<key>UIApplicationSupportsIndirectInputEvents</key>
|
41
|
+
<true/>
|
42
|
+
<key>UILaunchStoryboardName</key>
|
43
|
+
<string>LaunchScreen</string>
|
44
|
+
<key>UIRequiredDeviceCapabilities</key>
|
45
|
+
<array>
|
46
|
+
<string>armv7</string>
|
47
|
+
</array>
|
48
|
+
<key>UISupportedInterfaceOrientations</key>
|
49
|
+
<array>
|
50
|
+
<string>UIInterfaceOrientationPortrait</string>
|
51
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
52
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
53
|
+
</array>
|
54
|
+
<key>UISupportedInterfaceOrientations~ipad</key>
|
55
|
+
<array>
|
56
|
+
<string>UIInterfaceOrientationPortrait</string>
|
57
|
+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
58
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
59
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
60
|
+
</array>
|
61
|
+
</dict>
|
62
|
+
</plist>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
//
|
2
|
+
// SceneDelegate.swift
|
3
|
+
// Test
|
4
|
+
//
|
5
|
+
// Created by Claire Peyron on 12/04/2021.
|
6
|
+
//
|
7
|
+
|
8
|
+
import UIKit
|
9
|
+
import SwiftUI
|
10
|
+
|
11
|
+
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
12
|
+
|
13
|
+
var window: UIWindow?
|
14
|
+
|
15
|
+
|
16
|
+
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
17
|
+
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
|
18
|
+
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
|
19
|
+
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
20
|
+
|
21
|
+
// Create the SwiftUI view that provides the window contents.
|
22
|
+
let contentView = ContentView()
|
23
|
+
|
24
|
+
// Use a UIHostingController as window root view controller.
|
25
|
+
if let windowScene = scene as? UIWindowScene {
|
26
|
+
let window = UIWindow(windowScene: windowScene)
|
27
|
+
window.rootViewController = UIHostingController(rootView: contentView)
|
28
|
+
self.window = window
|
29
|
+
window.makeKeyAndVisible()
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
func sceneDidDisconnect(_ scene: UIScene) {
|
34
|
+
// Called as the scene is being released by the system.
|
35
|
+
// This occurs shortly after the scene enters the background, or when its session is discarded.
|
36
|
+
// Release any resources associated with this scene that can be re-created the next time the scene connects.
|
37
|
+
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
|
38
|
+
}
|
39
|
+
|
40
|
+
func sceneDidBecomeActive(_ scene: UIScene) {
|
41
|
+
// Called when the scene has moved from an inactive state to an active state.
|
42
|
+
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
|
43
|
+
}
|
44
|
+
|
45
|
+
func sceneWillResignActive(_ scene: UIScene) {
|
46
|
+
// Called when the scene will move from an active state to an inactive state.
|
47
|
+
// This may occur due to temporary interruptions (ex. an incoming phone call).
|
48
|
+
}
|
49
|
+
|
50
|
+
func sceneWillEnterForeground(_ scene: UIScene) {
|
51
|
+
// Called as the scene transitions from the background to the foreground.
|
52
|
+
// Use this method to undo the changes made on entering the background.
|
53
|
+
}
|
54
|
+
|
55
|
+
func sceneDidEnterBackground(_ scene: UIScene) {
|
56
|
+
// Called as the scene transitions from the foreground to the background.
|
57
|
+
// Use this method to save data, release shared resources, and store enough scene-specific state information
|
58
|
+
// to restore the scene back to its current state.
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
}
|
63
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
Test: en
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
3
|
+
<dependencies>
|
4
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
5
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
6
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
7
|
+
</dependencies>
|
8
|
+
<scenes>
|
9
|
+
<!--View Controller-->
|
10
|
+
<scene sceneID="EHf-IW-A2E">
|
11
|
+
<objects>
|
12
|
+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
13
|
+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
14
|
+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
15
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
16
|
+
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
17
|
+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
18
|
+
</view>
|
19
|
+
</viewController>
|
20
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
21
|
+
</objects>
|
22
|
+
<point key="canvasLocation" x="53" y="375"/>
|
23
|
+
</scene>
|
24
|
+
</scenes>
|
25
|
+
</document>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
3
|
+
<dependencies>
|
4
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
5
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
6
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
7
|
+
</dependencies>
|
8
|
+
<scenes>
|
9
|
+
<!--View Controller-->
|
10
|
+
<scene sceneID="EHf-IW-A2E">
|
11
|
+
<objects>
|
12
|
+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
13
|
+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
14
|
+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
15
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
16
|
+
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
17
|
+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
18
|
+
</view>
|
19
|
+
</viewController>
|
20
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
21
|
+
</objects>
|
22
|
+
<point key="canvasLocation" x="53" y="375"/>
|
23
|
+
</scene>
|
24
|
+
</scenes>
|
25
|
+
</document>
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "#{File.dirname(__FILE__)}/../ext/localizationlinter/localizationlinter.rb"
|
4
|
+
require File.expand_path('spec_helper', __dir__)
|
5
|
+
|
6
|
+
# rubocop:disable Metrics/BlockLength
|
7
|
+
module Danger
|
8
|
+
describe Danger::DangerLocalizationlinter do
|
9
|
+
it 'should be a plugin' do
|
10
|
+
expect(Danger::DangerLocalizationlinter.new(nil)).to be_a Danger::Plugin
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'with Dangerfile' do
|
14
|
+
before do
|
15
|
+
@fixtures_path = "#{File.dirname(__FILE__)}/support/fixtures"
|
16
|
+
@dangerfile = testing_dangerfile
|
17
|
+
@my_plugin = @dangerfile.localizationlinter
|
18
|
+
@my_plugin.verbose = true
|
19
|
+
@my_plugin.clean_after_execution = false
|
20
|
+
@my_plugin.language_configuration_path = "#{@fixtures_path}/all_target_main_language.yml"
|
21
|
+
@my_plugin.derived_data_path = "#{@fixtures_path}/derived_data"
|
22
|
+
@my_plugin.resource_path = "#{@fixtures_path}/resources"
|
23
|
+
@ok_target = 'TEST_OK'
|
24
|
+
@main_region = 'en'
|
25
|
+
@test_region = 'fr'
|
26
|
+
@main_file_name = @my_plugin.linter.temporary_localizable_check_file_path(@ok_target, @main_region)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'Test main_region_for_target' do
|
30
|
+
expect(@my_plugin.linter.main_region_for_target(@ok_target)).to eq(@main_region)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'Test temporary_localizable_check_file_path' do
|
34
|
+
expect(@main_file_name).to eq("#{@my_plugin.derived_data_path}/#{@ok_target}_#{@main_region}")
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'Test get_hash' do
|
38
|
+
# rubocop:disable Style/WordArray
|
39
|
+
result = {
|
40
|
+
'L10n' => {
|
41
|
+
'StringKey' => ['Int'],
|
42
|
+
'localized_key' => [],
|
43
|
+
'localized_key.sub_path_param' => ['String', 'Int'],
|
44
|
+
'localized_key_param' => ['String', 'String']
|
45
|
+
}
|
46
|
+
}
|
47
|
+
# rubocop:enable Style/WordArray
|
48
|
+
expect(@my_plugin.linter.get_hash(@main_file_name)).to eq(result)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'Test check_missing_keys_in_target OK' do
|
52
|
+
hash = @my_plugin.linter.get_hash(@main_file_name)
|
53
|
+
expect { @my_plugin.linter.check_missing_key(@ok_target, @test_region, @main_region, hash) }
|
54
|
+
.to raise_error(LocalizationLinter::RegionHashIdenticalAsMainOne)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'Test check_missing_keys_in_target KO' do
|
58
|
+
target = 'TEST_KO'
|
59
|
+
main_file_name = @my_plugin.linter.temporary_localizable_check_file_path(target, @main_region)
|
60
|
+
hash = @my_plugin.linter.get_hash(main_file_name)
|
61
|
+
fixtures_aboslute_path = "#{Dir.pwd}/spec/support/fixtures"
|
62
|
+
filepath = "#{fixtures_aboslute_path}/resources/#{target}/#{@test_region}.lproj/Localizable.strings"
|
63
|
+
# rubocop:disable Style/HashSyntax
|
64
|
+
result = [
|
65
|
+
{
|
66
|
+
:filename => filepath,
|
67
|
+
:key => 'localized_key_useless_key',
|
68
|
+
:line => 8,
|
69
|
+
:message => 'useless key: /L10n/localized_key_useless_key'
|
70
|
+
},
|
71
|
+
{
|
72
|
+
:filename => filepath,
|
73
|
+
:key => 'localized_key_missing_key',
|
74
|
+
:line => 0,
|
75
|
+
:message => 'missing key: /L10n/localized_key_missing_key'
|
76
|
+
},
|
77
|
+
{
|
78
|
+
:filename => filepath,
|
79
|
+
:key => 'localized_key.sub_path_param_wrong_param',
|
80
|
+
:line => 11,
|
81
|
+
:message => 'wrong parameters in key: /L10n/localized_key.sub_path_param_wrong_param/1/String'
|
82
|
+
}
|
83
|
+
]
|
84
|
+
# rubocop:enable Style/HashSyntax
|
85
|
+
expect(@my_plugin.linter.check_missing_key(target, @test_region, @main_region, hash)).to eq(result)
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'Test write_l10n_check_file with SwiftGen' do
|
89
|
+
target = 'TEST'
|
90
|
+
@my_plugin.swift_gen_path = "#{File.dirname(__FILE__)}/Test/Pods/SwiftGen/bin/swiftgen"
|
91
|
+
base_path = "#{@my_plugin.derived_data_path}/#{@ok_target}_#{@main_region}"
|
92
|
+
result_path = "#{@my_plugin.derived_data_path}/#{target}_#{@main_region}"
|
93
|
+
File.delete(result_path) if File.exist?(result_path)
|
94
|
+
@my_plugin.linter.write_l10n_check_file(target, @main_region)
|
95
|
+
expect(@my_plugin.linter.get_hash(result_path)).to eq(@my_plugin.linter.get_hash(base_path))
|
96
|
+
File.delete(result_path) if File.exist?(result_path)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'Test end to end in a project' do
|
100
|
+
@my_plugin.swift_gen_path = "#{File.dirname(__FILE__)}/Test/Pods/SwiftGen/bin/swiftgen"
|
101
|
+
@my_plugin.project_path = "#{File.dirname(__FILE__)}/Test/Test.xcodeproj"
|
102
|
+
@my_plugin.resource_path = "#{File.dirname(__FILE__)}/Test"
|
103
|
+
@my_plugin.language_configuration_path = "#{File.dirname(__FILE__)}/Test/Test/all_target_main_language.yml"
|
104
|
+
@my_plugin.derived_data_path = "#{File.dirname(__FILE__)}/Test/derived_data"
|
105
|
+
@my_plugin.inline_mode = true
|
106
|
+
@my_plugin.lint
|
107
|
+
output = @my_plugin.status_report[:warnings]
|
108
|
+
expect(output.size).to eq(3)
|
109
|
+
expect(output[0]).to include('useless key: /L10n/french_key')
|
110
|
+
expect(output[1]).to include('missing key: /L10n/english_key')
|
111
|
+
expect(output[2]).to include('missing key: /L10n/common_parametered_key/0')
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
# rubocop:enable Metrics/BlockLength
|