Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add knownRegions to generated projects #792

Merged
merged 3 commits into from Dec 16, 2019

Conversation

kwridan
Copy link
Collaborator

@kwridan kwridan commented Dec 15, 2019

Part of: #659

Short description πŸ“

Generated projects were missing an exhaustive list of known regions. This causes Xcode to immediately modify generated projects on launch to fix this.

Solution πŸ“¦

The list of known regions can be included in the generated projects. Based on localizable resources we can infer the known regions of the project.

This can be achieved by keeping track of the localizations encountered when adding while adding localizable resource file elements.

Implementation πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

  • Update ProjectFileElements to keep track of localizations
  • Update ProjectGenerator to set the appropriate knownRegions based on the localisations tracked by the ProjectFileElements
  • Update changelog

Test Plan πŸ› 

  • Run tuist generate within fixtures/ios_app_with_framework_and_resources
  • Verify the generated project MainApp has both "English" and "French" in the list of localizations in the project's info tab

- Based on localizable resources we can infer the knownRegions of the project
- While adding localizable resources file elements we can keep track of the languages encountered

Test Plan:

- Run `tuist generate` within `fixtures/ios_app_with_framework_and_resources`
- Verify the generated project MainApp has both "English" and "French" in the list of localizations in the project's info tab
Copy link
Contributor

@pepicrft pepicrft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a CHANGELOG update and I think we can go ahead and merge the PR. Good catch @kwridan !

configurationList: XCConfigurationList,
groups: ProjectGroups,
pbxproj: PBXProj) throws -> PBXProject {
let defaultRegions = ["en"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is en a default region always, is there a possibility you can have other region as default?

Copy link
Collaborator Author

@kwridan kwridan Dec 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment its set the match the default region generated by Tuist:

https://github.com/tuist/tuist/pull/792/files/18e490be0c7cbdda8e00e64c3d8514ab63d05c39#diff-8003e7a5fde9a1f00d9e93c3bad58745R148

https://github.com/tuist/XcodeProj/blob/master/Sources/XcodeProj/Project/Xcode.swift#L47

Could be a separate enhancement to support specifying the default development regions.

@kwridan kwridan merged commit 2f3029d into tuist:master Dec 16, 2019
@kwridan kwridan deleted the fix/known-regions branch December 16, 2019 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants