Skip to content

Commit fc9a8d9

Browse files
committed
Merge branch 'master' into #345
2 parents c52ce6d + 87517b4 commit fc9a8d9

File tree

10 files changed

+101
-52
lines changed

10 files changed

+101
-52
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
branches:
1515
- 'master'
1616

17+
env:
18+
XCODE_VERSION: '16.4'
19+
1720
jobs:
1821
danger-swiftlint:
1922
name: Danger SwiftLint
@@ -38,16 +41,21 @@ jobs:
3841
name: PodLint
3942
needs: test
4043
runs-on: macos-15
44+
timeout-minutes: 40
4145
if: github.event_name == 'pull_request'
4246
steps:
4347
- uses: actions/checkout@v4
4448

49+
- uses: maxim-lobanov/setup-xcode@v1
50+
with:
51+
xcode-version: ${{ env.XCODE_VERSION }}
52+
4553
- name: Install CocoaPods
4654
working-directory: Example
4755
run: pod install
4856

4957
- name: Lint pod library
50-
run: pod lib lint --skip-tests --platforms=macos,ios,tvos --allow-warnings
58+
run: pod lib lint --skip-tests --platforms=macos,ios,tvos --allow-warnings --fail-fast
5159

5260
spm-build:
5361
name: Build Swift Package
@@ -69,7 +77,7 @@ jobs:
6977

7078
- uses: maxim-lobanov/setup-xcode@v1
7179
with:
72-
xcode-version: 16.0
80+
xcode-version: ${{ env.XCODE_VERSION }}
7381

7482
- name: Install xcbeautify
7583
run: brew install xcbeautify
@@ -94,7 +102,7 @@ jobs:
94102

95103
- uses: maxim-lobanov/setup-xcode@v1
96104
with:
97-
xcode-version: 16.0
105+
xcode-version: ${{ env.XCODE_VERSION }}
98106

99107
- name: Build
100108
working-directory: Example
@@ -111,19 +119,35 @@ jobs:
111119
name: Test
112120
needs: build
113121
runs-on: macos-15
122+
timeout-minutes: 20
114123
steps:
115124
- uses: actions/checkout@v4
116125

126+
- name: Cache CocoaPods
127+
uses: actions/cache@v4
128+
with:
129+
path: Tests/Pods
130+
key: ${{ runner.os }}-pods-tests-${{ hashFiles('Tests/Podfile.lock') }}
131+
132+
- name: Cache Xcode Derived Data
133+
uses: actions/cache@v4
134+
with:
135+
path: ~/Library/Developer/Xcode/DerivedData
136+
key: ${{ runner.os }}-xcode-derived-${{ hashFiles('Tests/**/*.swift', 'Tests/**/*.m', 'Tests/**/*.h') }}
137+
117138
- name: Install CocoaPods
118139
working-directory: Tests
119-
run: pod install
140+
run: |
141+
if [ ! -d "Pods" ]; then
142+
pod install
143+
fi
120144
121145
- name: Install xcbeautify
122146
run: brew install xcbeautify
123147

124148
- uses: maxim-lobanov/setup-xcode@v1
125149
with:
126-
xcode-version: 16.0
150+
xcode-version: ${{ env.XCODE_VERSION }}
127151

128152
- name: Tests
129153
working-directory: Tests

.github/workflows/publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
types: [released]
66
workflow_dispatch:
77

8+
env:
9+
XCODE_VERSION: '16.4'
10+
811
jobs:
912
publish:
1013
runs-on: macos-latest
@@ -13,6 +16,10 @@ jobs:
1316
steps:
1417
- uses: actions/checkout@v4
1518

19+
- uses: maxim-lobanov/setup-xcode@v1
20+
with:
21+
xcode-version: ${{ env.XCODE_VERSION }}
22+
1623
- name: Install cocoapods
1724
run: gem install cocoapods
1825

CrowdinSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |spec|
1010
spec.name = 'CrowdinSDK'
11-
spec.version = '1.12.1'
11+
spec.version = '1.12.2'
1212
spec.summary = 'Crowdin iOS SDK delivers all new translations from Crowdin project to the application immediately'
1313

1414
spec.description = <<-DESC

Example/Podfile.lock

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
PODS:
22
- BaseAPI (0.2.2)
3-
- CrowdinSDK (1.12.1):
4-
- CrowdinSDK/Core (= 1.12.1)
5-
- CrowdinSDK/CrowdinProvider (= 1.12.1)
6-
- CrowdinSDK/Core (1.12.1):
3+
- CrowdinSDK (1.12.2):
4+
- CrowdinSDK/Core (= 1.12.2)
5+
- CrowdinSDK/CrowdinProvider (= 1.12.2)
6+
- CrowdinSDK/Core (1.12.2):
77
- CrowdinSDK/CrowdinFileSystem
8-
- CrowdinSDK/CrowdinAPI (1.12.1):
8+
- CrowdinSDK/CrowdinAPI (1.12.2):
99
- BaseAPI (~> 0.2.2)
1010
- CrowdinSDK/Core
11-
- CrowdinSDK/CrowdinFileSystem (1.12.1)
12-
- CrowdinSDK/CrowdinProvider (1.12.1):
11+
- CrowdinSDK/CrowdinFileSystem (1.12.2)
12+
- CrowdinSDK/CrowdinProvider (1.12.2):
1313
- CrowdinSDK/Core
1414
- CrowdinSDK/CrowdinAPI
1515
- CrowdinSDK/CrowdinFileSystem
16-
- CrowdinSDK/CrowdinXCTestScreenshots (1.12.1):
16+
- CrowdinSDK/CrowdinXCTestScreenshots (1.12.2):
1717
- CrowdinSDK/Core
1818
- CrowdinSDK/CrowdinAPI
1919
- CrowdinSDK/CrowdinProvider
2020
- CrowdinSDK/Screenshots
21-
- CrowdinSDK/IntervalUpdate (1.12.1):
21+
- CrowdinSDK/IntervalUpdate (1.12.2):
2222
- CrowdinSDK/Core
2323
- CrowdinSDK/CrowdinAPI
2424
- CrowdinSDK/CrowdinProvider
25-
- CrowdinSDK/LoginFeature (1.12.1):
25+
- CrowdinSDK/LoginFeature (1.12.2):
2626
- BaseAPI (~> 0.2.2)
2727
- CrowdinSDK/Core
2828
- CrowdinSDK/CrowdinAPI
2929
- CrowdinSDK/CrowdinProvider
30-
- CrowdinSDK/RealtimeUpdate (1.12.1):
30+
- CrowdinSDK/RealtimeUpdate (1.12.2):
3131
- CrowdinSDK/Core
3232
- CrowdinSDK/CrowdinAPI
3333
- CrowdinSDK/CrowdinProvider
3434
- CrowdinSDK/LoginFeature
3535
- Starscream (~> 4.0.4)
36-
- CrowdinSDK/RefreshLocalization (1.12.1):
36+
- CrowdinSDK/RefreshLocalization (1.12.2):
3737
- CrowdinSDK/Core
3838
- CrowdinSDK/CrowdinAPI
3939
- CrowdinSDK/CrowdinProvider
40-
- CrowdinSDK/Screenshots (1.12.1):
40+
- CrowdinSDK/Screenshots (1.12.2):
4141
- CrowdinSDK/Core
4242
- CrowdinSDK/CrowdinAPI
4343
- CrowdinSDK/CrowdinProvider
4444
- CrowdinSDK/LoginFeature
45-
- CrowdinSDK/Settings (1.12.1):
45+
- CrowdinSDK/Settings (1.12.2):
4646
- CrowdinSDK/Core
4747
- CrowdinSDK/CrowdinAPI
4848
- CrowdinSDK/CrowdinProvider
@@ -80,7 +80,7 @@ EXTERNAL SOURCES:
8080

8181
SPEC CHECKSUMS:
8282
BaseAPI: 7d1c79778a5c85f8e05f5e5c9d7f9be6474a53eb
83-
CrowdinSDK: c181e34fb10d13a436be371ad5bc7bcb7b042318
83+
CrowdinSDK: c27c02e2995fb58ffb65113b2c7bc03e67dea36f
8484
Realm: 490aad28f1360e58fc22256d5d686d3a36525346
8585
RealmSwift: f6a9b56d747bbdd7931de1835896c5f024b6898a
8686
Starscream: fb2c4510bebf908c62bd383bcf05e673720e91fd

ObjCExample/Podfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
PODS:
22
- BaseAPI (0.2.2)
3-
- CrowdinSDK (1.12.1):
4-
- CrowdinSDK/Core (= 1.12.1)
5-
- CrowdinSDK/CrowdinProvider (= 1.12.1)
6-
- CrowdinSDK/Core (1.12.1):
3+
- CrowdinSDK (1.12.2):
4+
- CrowdinSDK/Core (= 1.12.2)
5+
- CrowdinSDK/CrowdinProvider (= 1.12.2)
6+
- CrowdinSDK/Core (1.12.2):
77
- CrowdinSDK/CrowdinFileSystem
8-
- CrowdinSDK/CrowdinAPI (1.12.1):
8+
- CrowdinSDK/CrowdinAPI (1.12.2):
99
- BaseAPI (~> 0.2.2)
1010
- CrowdinSDK/Core
11-
- CrowdinSDK/CrowdinFileSystem (1.12.1)
12-
- CrowdinSDK/CrowdinProvider (1.12.1):
11+
- CrowdinSDK/CrowdinFileSystem (1.12.2)
12+
- CrowdinSDK/CrowdinProvider (1.12.2):
1313
- CrowdinSDK/Core
1414
- CrowdinSDK/CrowdinAPI
1515
- CrowdinSDK/CrowdinFileSystem
@@ -27,7 +27,7 @@ EXTERNAL SOURCES:
2727

2828
SPEC CHECKSUMS:
2929
BaseAPI: 7d1c79778a5c85f8e05f5e5c9d7f9be6474a53eb
30-
CrowdinSDK: c181e34fb10d13a436be371ad5bc7bcb7b042318
30+
CrowdinSDK: c27c02e2995fb58ffb65113b2c7bc03e67dea36f
3131

3232
PODFILE CHECKSUM: 530155f41b1d99b9cdd5bfd43d94fc0d9d7a9e49
3333

Sources/CrowdinSDK/Providers/Crowdin/LocalizationDownloader/CrowdinLocalizationDownloader.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class CrowdinLocalizationDownloader: CrowdinDownloaderProtocol {
3131
guard let self = self else { return }
3232
if let files = files {
3333
let xcstringsFiles = files.filter({ $0.isXcstrings })
34+
// For xcstrings we need to parse existing files when localization is changed, otherwise we wont get localization strings from xcstrings files.
35+
self.parseXCStrings(files: xcstringsFiles, for: localization)
3436
let notXcstringsFiles = files.filter({ !$0.isXcstrings })
3537
let notXcstringsFilesToDownload = notXcstringsFiles.filter { self.manifestManager.hasFileChanged(filePath: $0, localization: localization) }
3638
let xcStringsFilesToDownlaod = xcstringsFiles.filter({ self.manifestManager.hasFileChanged(filePath: $0, localization: self.manifestManager.xcstringsLanguage) })
@@ -42,7 +44,7 @@ class CrowdinLocalizationDownloader: CrowdinDownloaderProtocol {
4244
xcstrings: filesToDownload.filter({ $0.isXcstrings }),
4345
with: hash, timestamp: timestamp, for: localization)
4446
} else {
45-
self.completion?(nil, nil, nil)
47+
self.completion?(self.strings, self.plurals, self.errors)
4648
}
4749
} else if let error = error {
4850
self.lock.lock()
@@ -186,8 +188,20 @@ class CrowdinLocalizationDownloader: CrowdinDownloaderProtocol {
186188
}
187189
lock.unlock()
188190
}
191+
189192
func updateTimestamp(for localization: String, filePath: String, timestamp: TimeInterval) {
190193
manifestManager.fileTimestampStorage.updateTimestamp(for: localization, filePath: filePath, timestamp: timestamp)
191194
manifestManager.fileTimestampStorage.saveTimestamps()
192195
}
196+
197+
private func parseXCStrings(files: [String], for localization: String) {
198+
for xcstringsFile in files {
199+
if let data = XCStringsStorage.getFile(path: xcstringsFile) {
200+
let parsed = XcstringsParser.parse(data: data, localization: localization)
201+
self.add(strings: parsed.strings)
202+
self.add(plurals: parsed.plurals)
203+
self.add(error: parsed.error)
204+
}
205+
}
206+
}
193207
}

Sources/Tests/Core/RealLocalizationProviderTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class RealLocalizationProviderTests: XCTestCase {
3131

3232
override func tearDown() {
3333
localizationProvider.deintegrate()
34+
ManifestManager.clear()
3435
}
3536

3637
func testInitialization() {

Tests/Podfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
PODS:
22
- BaseAPI (0.2.2)
3-
- CrowdinSDK (1.12.1):
4-
- CrowdinSDK/Core (= 1.12.1)
5-
- CrowdinSDK/CrowdinProvider (= 1.12.1)
6-
- CrowdinSDK/Core (1.12.1):
3+
- CrowdinSDK (1.12.2):
4+
- CrowdinSDK/Core (= 1.12.2)
5+
- CrowdinSDK/CrowdinProvider (= 1.12.2)
6+
- CrowdinSDK/Core (1.12.2):
77
- CrowdinSDK/CrowdinFileSystem
8-
- CrowdinSDK/Core_Tests (1.12.1)
9-
- CrowdinSDK/CrowdinAPI (1.12.1):
8+
- CrowdinSDK/Core_Tests (1.12.2)
9+
- CrowdinSDK/CrowdinAPI (1.12.2):
1010
- BaseAPI (~> 0.2.2)
1111
- CrowdinSDK/Core
12-
- CrowdinSDK/CrowdinAPI_Tests (1.12.1)
13-
- CrowdinSDK/CrowdinFileSystem (1.12.1)
14-
- CrowdinSDK/CrowdinProvider (1.12.1):
12+
- CrowdinSDK/CrowdinAPI_Tests (1.12.2)
13+
- CrowdinSDK/CrowdinFileSystem (1.12.2)
14+
- CrowdinSDK/CrowdinProvider (1.12.2):
1515
- CrowdinSDK/Core
1616
- CrowdinSDK/CrowdinAPI
1717
- CrowdinSDK/CrowdinFileSystem
18-
- CrowdinSDK/CrowdinProvider_Tests (1.12.1)
19-
- CrowdinSDK/LoginFeature (1.12.1):
18+
- CrowdinSDK/CrowdinProvider_Tests (1.12.2)
19+
- CrowdinSDK/LoginFeature (1.12.2):
2020
- BaseAPI (~> 0.2.2)
2121
- CrowdinSDK/Core
2222
- CrowdinSDK/CrowdinAPI
@@ -40,7 +40,7 @@ EXTERNAL SOURCES:
4040

4141
SPEC CHECKSUMS:
4242
BaseAPI: 7d1c79778a5c85f8e05f5e5c9d7f9be6474a53eb
43-
CrowdinSDK: c181e34fb10d13a436be371ad5bc7bcb7b042318
43+
CrowdinSDK: c27c02e2995fb58ffb65113b2c7bc03e67dea36f
4444

4545
PODFILE CHECKSUM: 3efeda1a4b0cfa7f4d6d66e1bee4ee5a1048af75
4646

website/docs/setup.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ In the `application` method add:
4040
let crowdinProviderConfig = CrowdinProviderConfig(hashString: "{distribution_hash}",
4141
sourceLanguage: "{source_language}")
4242

43+
let crowdinSDKConfig = CrowdinSDKConfig.config()
44+
.with(crowdinProviderConfig: crowdinProviderConfig)
45+
4346
CrowdinSDK.startWithConfig(crowdinSDKConfig, completion: {
4447
// SDK is ready to use, put code to change language, etc. here
4548
})

website/package-lock.json

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

0 commit comments

Comments
 (0)