mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
add ProjectSpec.options.developmentLanguage
This commit is contained in:
+3
-1
@@ -69,7 +69,9 @@ Note that target names can also be changed by adding a `name` property to a targ
|
||||
- `all`: project and target settings
|
||||
- `project`: only project settings
|
||||
- `targets`: only target settings
|
||||
- `none`: no settings are automatically applied
|
||||
- `none`: no settings are automatically applied
|
||||
- ⚪️ **developmentLanguage**: `String` - Sets the development language of the project. Defaults to `en`
|
||||
|
||||
### Configs
|
||||
Each config maps to a build type of either `debug` or `release` which will then apply default build settings to the project. Any value other than `debug` or `release` (for example `none`), will mean no default build settings will be applied to the project.
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public struct ProjectSpec {
|
||||
public var createIntermediateGroups: Bool
|
||||
public var bundleIdPrefix: String?
|
||||
public var settingPresets: SettingPresets
|
||||
public var developmentLanguage: String?
|
||||
|
||||
public enum SettingPresets: String {
|
||||
case all
|
||||
@@ -54,11 +55,12 @@ public struct ProjectSpec {
|
||||
}
|
||||
}
|
||||
|
||||
public init(carthageBuildPath: String? = nil, createIntermediateGroups: Bool = false, bundleIdPrefix: String? = nil, settingPresets: SettingPresets = .all) {
|
||||
public init(carthageBuildPath: String? = nil, createIntermediateGroups: Bool = false, bundleIdPrefix: String? = nil, settingPresets: SettingPresets = .all, developmentLanguage: String? = nil) {
|
||||
self.carthageBuildPath = carthageBuildPath
|
||||
self.createIntermediateGroups = createIntermediateGroups
|
||||
self.bundleIdPrefix = bundleIdPrefix
|
||||
self.settingPresets = settingPresets
|
||||
self.developmentLanguage = developmentLanguage
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ public class PBXProjGenerator {
|
||||
buildConfigurationList: buildConfigList.reference,
|
||||
compatibilityVersion: "Xcode 3.2",
|
||||
mainGroup: mainGroup.reference,
|
||||
developmentRegion: "English",
|
||||
developmentRegion: spec.options.developmentLanguage ?? "en",
|
||||
knownRegions: knownRegions,
|
||||
targets: targets.references,
|
||||
attributes: projectAttributes)
|
||||
|
||||
@@ -471,7 +471,7 @@
|
||||
};
|
||||
buildConfigurationList = CL_844877120535 /* Build configuration list for PBXProject "Project" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
developmentRegion = en;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
|
||||
@@ -52,6 +52,16 @@ func projectGeneratorTests() {
|
||||
let allSettings = project.pbxproj.buildConfigurations.reduce([:]) { $0.merged($1.buildSettings) }.keys.sorted()
|
||||
try expect(allSettings) == ["SETTING_2"]
|
||||
}
|
||||
|
||||
$0.it("generates development language") {
|
||||
let options = ProjectSpec.Options(developmentLanguage: "de")
|
||||
let spec = ProjectSpec(basePath: "", name: "test", options: options)
|
||||
let project = try getProject(spec)
|
||||
guard let pbxProject = project.pbxproj.projects.first else {
|
||||
throw failure("Could't find PBXProject")
|
||||
}
|
||||
try expect(pbxProject.developmentRegion) == "de"
|
||||
}
|
||||
}
|
||||
|
||||
$0.describe("Config") {
|
||||
|
||||
Reference in New Issue
Block a user