Skip to content

Commit 96b4c94

Browse files
authored
Merge pull request #15 from 1998code/6.0-preview
6.0 Enhancement
2 parents 8b6d0ed + f85aef8 commit 96b4c94

File tree

20 files changed

+2315
-364
lines changed

20 files changed

+2315
-364
lines changed
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
name: Validate JSON Files
2+
3+
on:
4+
push:
5+
paths:
6+
- '**/*.json'
7+
pull_request:
8+
paths:
9+
- '**/*.json'
10+
workflow_dispatch: # Allows manual triggering
11+
12+
jobs:
13+
validate-json:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18'
24+
25+
- name: Install dependencies
26+
run: npm install -g ajv-cli ajv-formats
27+
28+
- name: Create JSON schema for validation
29+
run: |
30+
cat > schema.json << 'EOL'
31+
{
32+
"$schema": "http://json-schema.org/draft-07/schema#",
33+
"type": "array",
34+
"items": {
35+
"type": "object",
36+
"required": ["version", "new"],
37+
"properties": {
38+
"version": {
39+
"type": "string",
40+
"pattern": "^\\d+\\.\\d+$|^\\d+\\.\\d+\\.\\d+$"
41+
},
42+
"subVersion": {
43+
"type": "string",
44+
"pattern": "^\\d+\\.\\d+\\.\\d+$"
45+
},
46+
"new": {
47+
"type": "array",
48+
"items": {
49+
"type": "object",
50+
"required": ["icon", "title", "subtitle", "body"],
51+
"properties": {
52+
"icon": { "type": "string" },
53+
"title": { "type": "string" },
54+
"subtitle": { "type": "string" },
55+
"body": { "type": "string" }
56+
}
57+
},
58+
"minItems": 1
59+
}
60+
}
61+
},
62+
"minItems": 1
63+
}
64+
EOL
65+
66+
- name: Scan for JSON files
67+
id: scan
68+
run: |
69+
echo "Scanning for JSON files..."
70+
# Create a temporary file to store the list of JSON files
71+
touch json_files.txt
72+
73+
# Find all data.json files and group them by language
74+
find Demo -name "data.json" -print0 | while IFS= read -r -d '' FILE; do
75+
# Extract the language from the directory path
76+
LANG_DIR=$(dirname "$FILE")
77+
LANG=$(basename "$LANG_DIR")
78+
echo "$LANG:$FILE" >> json_files.txt
79+
done
80+
81+
echo "Found the following JSON files for validation:"
82+
cat json_files.txt
83+
84+
echo "Scan completed."
85+
86+
- name: Validate JSON syntax per language
87+
run: |
88+
echo "Validating JSON syntax for each language..."
89+
ERROR=0
90+
91+
# Process each file by language
92+
while IFS=':' read -r LANG_DIR FILE || [ -n "$FILE" ]; do
93+
echo "Checking syntax for language: $LANG_DIR - $FILE"
94+
95+
# Check JSON syntax
96+
if ! jq empty "$FILE" 2>/dev/null; then
97+
echo "❌ Invalid JSON syntax in $LANG_DIR ($FILE)"
98+
ERROR=1
99+
else
100+
echo "✅ JSON syntax is valid for $LANG_DIR"
101+
fi
102+
done < json_files.txt
103+
104+
if [ $ERROR -ne 0 ]; then
105+
echo "JSON syntax validation failed"
106+
exit 1
107+
fi
108+
109+
- name: Validate schema per language
110+
run: |
111+
echo "Validating JSON schema for each language..."
112+
ERROR=0
113+
114+
# Process each file by language
115+
while IFS=':' read -r LANG_DIR FILE || [ -n "$FILE" ]; do
116+
echo "Validating schema for language: $LANG_DIR - $FILE"
117+
118+
# Validate against schema
119+
if ! npx ajv -s schema.json -d "$FILE" --strict=false; then
120+
echo "❌ $LANG_DIR ($FILE) does not match the required schema"
121+
ERROR=1
122+
else
123+
echo "✅ Schema is valid for $LANG_DIR"
124+
fi
125+
done < json_files.txt
126+
127+
if [ $ERROR -ne 0 ]; then
128+
echo "JSON schema validation failed"
129+
exit 1
130+
fi
131+
132+
echo "All JSON files are valid! 🎉"
133+
134+
check-localization-completeness:
135+
runs-on: ubuntu-latest
136+
needs: validate-json
137+
138+
steps:
139+
- name: Checkout repository
140+
uses: actions/checkout@v4
141+
142+
- name: Find JSON files
143+
id: find-json
144+
run: |
145+
# Create a directory to store extracted language files
146+
mkdir -p extracted_langs
147+
148+
# Find the base (en) language JSON file
149+
BASE_FILE=$(find Demo -path "*/en.lproj/data.json" -print -quit)
150+
if [ ! -f "$BASE_FILE" ]; then
151+
echo "❌ Base language file (en.lproj/data.json) not found!"
152+
exit 1
153+
fi
154+
155+
# Find all localized JSON files
156+
find Demo -name "data.json" | grep -v "$BASE_FILE" > localized_files.txt
157+
158+
echo "Base file: $BASE_FILE"
159+
echo "Found $(wc -l < localized_files.txt) localized files"
160+
161+
- name: Check for missing versions
162+
run: |
163+
BASE_FILE=$(find Demo -path "*/en.lproj/data.json" -print -quit)
164+
165+
# Extract version numbers from base file
166+
jq -r '.[].version' "$BASE_FILE" | sort -V > base_versions.txt
167+
168+
# Create a report file
169+
touch localization_report.md
170+
echo "# Localization Completeness Report" >> localization_report.md
171+
echo "Generated on $(date)" >> localization_report.md
172+
echo "" >> localization_report.md
173+
174+
# Check each localized file
175+
while read -r LOC_FILE; do
176+
LANG_DIR=$(dirname "$LOC_FILE")
177+
LANG=$(basename "$LANG_DIR" | sed 's/\.lproj//')
178+
179+
echo "## Checking $LANG" >> localization_report.md
180+
181+
# Extract version numbers from localized file
182+
jq -r '.[].version' "$LOC_FILE" | sort -V > "${LANG}_versions.txt"
183+
184+
# Find missing versions
185+
MISSING_VERSIONS=$(comm -23 base_versions.txt "${LANG}_versions.txt")
186+
187+
if [ -n "$MISSING_VERSIONS" ]; then
188+
echo "❌ $LANG is missing versions: $MISSING_VERSIONS"
189+
echo "### Missing versions:" >> localization_report.md
190+
echo '```' >> localization_report.md
191+
echo "$MISSING_VERSIONS" >> localization_report.md
192+
echo '```' >> localization_report.md
193+
echo "" >> localization_report.md
194+
EXIT_CODE=1
195+
else
196+
echo "✅ $LANG has all versions from base language"
197+
echo "✅ All versions present" >> localization_report.md
198+
echo "" >> localization_report.md
199+
fi
200+
201+
# Check content for each version
202+
echo "### Content comparison:" >> localization_report.md
203+
204+
while read -r VERSION; do
205+
# Extract base data for this version
206+
jq -r --arg v "$VERSION" '.[] | select(.version == $v)' "$BASE_FILE" > "base_${VERSION}.json"
207+
jq -r --arg v "$VERSION" '.[] | select(.version == $v)' "$LOC_FILE" > "${LANG}_${VERSION}.json"
208+
209+
if [ -s "${LANG}_${VERSION}.json" ]; then
210+
# Count items in the "new" array for base and localized
211+
BASE_ITEMS=$(jq -r '.new | length' "base_${VERSION}.json")
212+
LOC_ITEMS=$(jq -r '.new | length' "${LANG}_${VERSION}.json")
213+
214+
if [ "$BASE_ITEMS" -ne "$LOC_ITEMS" ]; then
215+
echo "❌ $LANG version $VERSION has $LOC_ITEMS items (base has $BASE_ITEMS)"
216+
echo "- Version $VERSION: $LOC_ITEMS/$BASE_ITEMS items ❌" >> localization_report.md
217+
EXIT_CODE=1
218+
else
219+
echo "✅ $LANG version $VERSION has all $BASE_ITEMS items"
220+
echo "- Version $VERSION: $LOC_ITEMS/$BASE_ITEMS items ✅" >> localization_report.md
221+
fi
222+
fi
223+
done < base_versions.txt
224+
225+
echo "" >> localization_report.md
226+
done < localized_files.txt
227+
228+
cat localization_report.md
229+
230+
# Exit with the accumulated status
231+
if [ "$EXIT_CODE" -eq 1 ]; then
232+
echo "❌ Localization check failed - some languages are missing versions or items"
233+
exit 1
234+
else
235+
echo "✅ All languages have complete translations"
236+
fi
237+
238+
- name: Upload Localization Report
239+
if: always()
240+
uses: actions/upload-artifact@v4
241+
with:
242+
name: localization-report
243+
path: localization_report.md

Demo/What's New?.xcodeproj/project.pbxproj

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
/* End PBXBuildFile section */
1818

1919
/* Begin PBXFileReference section */
20+
3A1D311B2DDA0F8900A67C5E /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = ja; path = ja.lproj/data.json; sourceTree = "<group>"; };
21+
3A1D311C2DDA0F9000A67C5E /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = ko; path = ko.lproj/data.json; sourceTree = "<group>"; };
2022
3A2BBE7B2D18129000A7CAF9 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = "zh-Hans"; path = "zh-Hans.lproj/data.json"; sourceTree = "<group>"; };
2123
3A46CBAC285444CC00BE79A3 /* What's New?.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "What's New?.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2224
3A46CBAF285444CC00BE79A3 /* What_s_New_App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = What_s_New_App.swift; sourceTree = "<group>"; };
@@ -136,6 +138,8 @@
136138
Base,
137139
"zh-Hant",
138140
"zh-Hans",
141+
ja,
142+
ko,
139143
);
140144
mainGroup = 3A46CBA3285444CC00BE79A3;
141145
packageReferences = (
@@ -182,6 +186,8 @@
182186
3AE0026B2962DD540055979A /* en */,
183187
3AE0026D2962DD810055979A /* zh-Hant */,
184188
3A2BBE7B2D18129000A7CAF9 /* zh-Hans */,
189+
3A1D311B2DDA0F8900A67C5E /* ja */,
190+
3A1D311C2DDA0F9000A67C5E /* ko */,
185191
);
186192
name = data.json;
187193
sourceTree = "<group>";
@@ -307,7 +313,7 @@
307313
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
308314
CODE_SIGN_ENTITLEMENTS = "What's New?/What_s_New_.entitlements";
309315
CODE_SIGN_STYLE = Automatic;
310-
CURRENT_PROJECT_VERSION = 14;
316+
CURRENT_PROJECT_VERSION = 15;
311317
DEVELOPMENT_ASSET_PATHS = "\"What's New?/Preview Content\"";
312318
DEVELOPMENT_TEAM = "";
313319
ENABLE_HARDENED_RUNTIME = YES;
@@ -317,21 +323,23 @@
317323
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES;
318324
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
319325
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
320-
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
326+
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
321327
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
322328
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
323-
MACOSX_DEPLOYMENT_TARGET = 12.0;
324-
MARKETING_VERSION = 5.5;
329+
MACOSX_DEPLOYMENT_TARGET = 14.0;
330+
MARKETING_VERSION = 6.0;
325331
PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew;
326332
PRODUCT_NAME = "$(TARGET_NAME)";
327333
SDKROOT = auto;
328-
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
334+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
329335
SUPPORTS_MACCATALYST = NO;
330336
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
331337
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
332338
SWIFT_EMIT_LOC_STRINGS = YES;
333339
SWIFT_VERSION = 5.0;
334-
TARGETED_DEVICE_FAMILY = "1,2,7";
340+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
341+
TVOS_DEPLOYMENT_TARGET = 17.0;
342+
VISIONOS_DEPLOYMENT_TARGET = 1.0;
335343
};
336344
name = Debug;
337345
};
@@ -342,7 +350,7 @@
342350
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
343351
CODE_SIGN_ENTITLEMENTS = "What's New?/What_s_New_.entitlements";
344352
CODE_SIGN_STYLE = Automatic;
345-
CURRENT_PROJECT_VERSION = 14;
353+
CURRENT_PROJECT_VERSION = 15;
346354
DEVELOPMENT_ASSET_PATHS = "\"What's New?/Preview Content\"";
347355
DEVELOPMENT_TEAM = "";
348356
ENABLE_HARDENED_RUNTIME = YES;
@@ -352,21 +360,23 @@
352360
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES;
353361
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
354362
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
355-
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
363+
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
356364
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
357365
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
358-
MACOSX_DEPLOYMENT_TARGET = 12.0;
359-
MARKETING_VERSION = 5.5;
366+
MACOSX_DEPLOYMENT_TARGET = 14.0;
367+
MARKETING_VERSION = 6.0;
360368
PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew;
361369
PRODUCT_NAME = "$(TARGET_NAME)";
362370
SDKROOT = auto;
363-
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
371+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
364372
SUPPORTS_MACCATALYST = NO;
365373
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
366374
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
367375
SWIFT_EMIT_LOC_STRINGS = YES;
368376
SWIFT_VERSION = 5.0;
369-
TARGETED_DEVICE_FAMILY = "1,2,7";
377+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
378+
TVOS_DEPLOYMENT_TARGET = 17.0;
379+
XROS_DEPLOYMENT_TARGET = 1.0;
370380
};
371381
name = Release;
372382
};

Demo/What's New?.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)