apache / apache/cordova-ios

Setting the `defaultlocale` should update developmentRegion and knownRegions in pbxproj

Open
#1,222 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
1k
Avg merge
12h 11m
Merged PRs (30d)
18

Description

# Feature Request

## Motivation Behind Feature

Since #237 adding a `defaultlocale="XX"` attribute to the `widget` tag in _config.xml_ allows to set the `CFBundleDevelopmentRegion` to a different language (in the _-Info.plist_ file).

⇒ This same language should also be applied into the pbxproj files of the project and CordovaLib, to replace the hardcoded `en` from the templates for `developmentRegion` and `knownRegions`.

## Feature Description

The templates for the project and CordovaLib are used to init the iOS project structure.

With previous #237, the [\_\_PROJECT_NAME\_\_-Info.plist](https://github.com/apache/cordova-ios/blob/master/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist) file is modified to target `CFBundleDevelopmentRegion` and replace the hardcoded value of [`en_US`](https://github.com/apache/cordova-ios/blob/master/templates/project/__PROJECT_NAME__/__PROJECT_NAME__-Info.plist#L6) with the language set through `defaultlocale`.

Same should be done in [project pbxproj](https://github.com/apache/cordova-ios/blob/master/templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj) file and [CordovaLib pbxproj](https://github.com/apache/cordova-ios/blob/master/CordovaLib/CordovaLib.xcodeproj/project.pbxproj) file, targeting [`developmentRegion`](https://github.com/apache/cordova-ios/blob/master/templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj#L236) ([+](https://github.com/apache/cordova-ios/blob/master/CordovaLib/CordovaLib.xcodeproj/project.pbxproj#L507)) and [`knownRegions`](https://github.com/apache/cordova-ios/blob/master/templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj#L238) ([+](https://github.com/apache/cordova-ios/blob/master/CordovaLib/CordovaLib.xcodeproj/project.pbxproj#L509)) and replacing the hardcoded value of `en` there too.

~(may require https://github.com/apache/cordova-node-xcode/issues/122?)~

## Alternatives or Workarounds

Custom script after platform add.

Or should I start a new cordova-plugin to add more defaults like this about locales? (to include this, https://github.com/apache/cordova-android/issues/1396, https://github.com/kelvinhokk/cordova-plugin-localization-strings/issues/65, and more?)

Contributor guide

Open the contributing guide

Research direction

Start with templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj and CordovaLib/CordovaLib.xcodeproj/project.pbxproj, then trace how they are populated during iOS project initialization. Verify that defaultlocale from config.xml replaces the hardcoded en in developmentRegion and knownRegions in both generated pbxproj files.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
build-system, mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.