Support for Strings Catalogs (Xcode 15) (#1421)

* Support for xcode 15 string catalogs

* Add sample string catalog to Test Fixture and basic test to check that asset catalogs are added in the resources build phase

* Restore unintended changes

* Update Pull Request number for 'Support for Strings Catalogs' in changelog

* Update fixture yml generator

* Detect knownRegions based on locales in string catalogs
This commit is contained in:
nicolasbosi95
2024-02-14 20:07:04 +11:00
committed by GitHub
parent 2c1500761d
commit 2881fcc8fb
9 changed files with 209 additions and 1 deletions
+10
View File
@@ -455,6 +455,7 @@ class SourceGenerator {
let createIntermediateGroups = targetSource.createIntermediateGroups ?? project.options.createIntermediateGroups
let nonLocalizedChildren = children.filter { $0.extension != "lproj" }
let stringCatalogChildren = children.filter { $0.extension == "xcstrings" }
let directories = nonLocalizedChildren
.filter {
@@ -520,6 +521,15 @@ class SourceGenerator {
}()
knownRegions.formUnion(localisedDirectories.map { $0.lastComponentWithoutExtension })
// XCode 15 - Detect known regions from locales present in string catalogs
let stringCatalogsLocales = stringCatalogChildren
.compactMap { StringCatalog(from: $0) }
.reduce(Set<String>(), { partialResult, stringCatalog in
partialResult.union(stringCatalog.includedLocales)
})
knownRegions.formUnion(stringCatalogsLocales)
// create variant groups of the base localisation first
var baseLocalisationVariantGroups: [PBXVariantGroup] = []