Localize iOS permission strings via InfoPlist.strings#134
Open
voicecode-bv wants to merge 1 commit into
Open
Conversation
iOS shows permission usage descriptions in the system language, but the existing `nativephp.permissions` config only feeds one set of strings into Info.plist — so prompts appear in whichever language the developer wrote, regardless of the user's device locale. This adds `nativephp.permission_localizations` (and the parallel plugin manifest key `ios.info_plist_localizations`) for per-locale overrides. At compile time the IOSPluginCompiler writes one .lproj/InfoPlist.strings file per locale inside the synced NativePHP group, where Xcode 16's PBXFileSystemSynchronizedRootGroup picks them up automatically; only `knownRegions` in the pbxproj needs a small update so the locales ship with the bundle. Info.plist remains the source of truth for the fallback language. App-level entries win over plugins on key collisions, matching the existing merge rules for flat permissions.
simonhamp
approved these changes
May 15, 2026
Member
simonhamp
left a comment
There was a problem hiding this comment.
I love it! Can you add a PR in the nativephp.com repo for the docs too?
Contributor
Author
|
Sure thing, there you go: https://github.com/NativePHP/nativephp.com/pull/383/commits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iOS shows permission usage descriptions in the system language, but the existing
nativephp.permissionsconfig only feeds one set of strings intoInfo.plist— so prompts appear in whichever language the developer wrote, regardless of the user's device locale.This PR adds per-locale overrides:
nativephp.permission_localizationsios.info_plist_localizationsAt compile time,
IOSPluginCompilerwrites one{locale}.lproj/InfoPlist.stringsfile per locale inside the syncedNativePHPgroup. Xcode 16'sPBXFileSystemSynchronizedRootGrouppicks the files up automatically; onlyknownRegionsin the pbxproj needs a small update so the locales ship with the bundle.Info.plistremains the source of truth for the fallback language.App-level entries win over plugins on key collisions, matching the existing merge rules for flat
permissions.Config example
Plugin manifest example
{ "ios": { "info_plist": { "NSCameraUsageDescription": "Used to take a profile photo." }, "info_plist_localizations": { "nl": { "NSCameraUsageDescription": "Gebruikt om een profielfoto te maken." } } } }Test plan
vendor/bin/pest)tests/Feature/Plugins/IOSCompilerTest.php:permission_localizationsproduce the right.lproj/InfoPlist.stringsfiles.stringsliteralsknownRegionsinproject.pbxprojcompile()is idempotent (no dupes in strings file or knownRegions)