Skip to content

Commit 6d3fc84

Browse files
simonhampclaude
andcommitted
Port iOS permission localization docs to mobile v4
Mirrors the v3 additions on the v4 docs: the `permission_localizations` config key in getting-started/configuration and the matching `ios.info_plist_localizations` manifest key in plugins/permissions-dependencies. Also corrects the cross-reference anchor in both v3 and v4 — the renderer strips the dot in "Info.plist", so the heading id is `localizing-infoplist-strings`, not `localizing-info-plist-strings`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent b386051 commit 6d3fc84

3 files changed

Lines changed: 73 additions & 1 deletion

File tree

‎resources/views/docs/mobile/3/getting-started/configuration.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ a locale block automatically falls back to the value from `permissions` (`Info.p
373373
</aside>
374374

375375
Plugins can ship their own per-locale strings — see
376-
[Permissions & Dependencies](../plugins/permissions-dependencies#localizing-info-plist-strings) — and
376+
[Permissions & Dependencies](../plugins/permissions-dependencies#localizing-infoplist-strings) — and
377377
app-level entries always win on key collisions, same as the merge rules for flat `permissions`.
378378

379379
## App Store Connect

‎resources/views/docs/mobile/4/getting-started/configuration.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,45 @@ are shown at runtime by app code, so there's no equivalent override.
337337

338338
</aside>
339339

340+
## Localizing iOS Permission Strings
341+
342+
The strings in `permissions` go straight into `Info.plist`, which iOS treats as the **development region**
343+
fallback. Users running their device in another language see those same strings unless you ship a localized
344+
override.
345+
346+
Add per-locale strings under `permission_localizations`. Each key is a BCP 47 locale code
347+
(e.g. `nl`, `fr`, `zh-Hans`, `pt-BR`) and its value mirrors the `permissions` shape:
348+
349+
```php
350+
'permissions' => [
351+
'NSCameraUsageDescription' => 'Used to take a profile photo.',
352+
],
353+
354+
'permission_localizations' => [
355+
'nl' => [
356+
'NSCameraUsageDescription' => 'Gebruikt om een profielfoto te maken.',
357+
],
358+
'fr' => [
359+
'NSCameraUsageDescription' => 'Utilisé pour prendre une photo de profil.',
360+
],
361+
],
362+
```
363+
364+
At build time NativePHP writes one `{locale}.lproj/InfoPlist.strings` file per locale inside the iOS bundle
365+
and registers the locale with the Xcode project so it ships with the app. iOS then picks the right string
366+
at runtime based on the user's preferred language, falling back to the value in `permissions`.
367+
368+
<aside>
369+
370+
You only need to localize the keys that change between languages. Any `NS*UsageDescription` not listed in
371+
a locale block automatically falls back to the value from `permissions` (`Info.plist`).
372+
373+
</aside>
374+
375+
Plugins can ship their own per-locale strings — see
376+
[Permissions & Dependencies](../plugins/permissions-dependencies#localizing-infoplist-strings) — and
377+
app-level entries always win on key collisions, same as the merge rules for flat `permissions`.
378+
340379
## App Store Connect
341380

342381
Configure automated iOS uploads with the App Store Connect API:

‎resources/views/docs/mobile/4/plugins/permissions-dependencies.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,39 @@ rejection. Explain *why* you need the permission.
8282

8383
</aside>
8484

85+
### Localizing Info.plist Strings
86+
87+
Values in `ios.info_plist` are written to the bundle's `Info.plist` and shown by iOS in whichever language
88+
they were authored. To translate them for users on other system languages, add a sibling
89+
`ios.info_plist_localizations` block. Each key is a BCP 47 locale code (e.g. `nl`, `fr`, `zh-Hans`,
90+
`pt-BR`) and its value mirrors the `info_plist` shape:
91+
92+
```json
93+
{
94+
"ios": {
95+
"info_plist": {
96+
"NSCameraUsageDescription": "This app uses the camera for scanning"
97+
},
98+
"info_plist_localizations": {
99+
"nl": {
100+
"NSCameraUsageDescription": "Deze app gebruikt de camera om te scannen"
101+
},
102+
"fr": {
103+
"NSCameraUsageDescription": "Cette application utilise la caméra pour le scan"
104+
}
105+
}
106+
}
107+
}
108+
```
109+
110+
At build time NativePHP writes one `{locale}.lproj/InfoPlist.strings` file per locale into the host app's
111+
iOS project, and iOS picks the right string at runtime based on the user's preferred language. Any key not
112+
present in a locale block falls back to the value from `info_plist`.
113+
114+
App-level overrides set in the host app's `config('nativephp.permission_localizations')` win over the values
115+
declared here — useful when an app developer needs to resolve collisions between plugins that ship
116+
localizations for the same key.
117+
85118
## Dependencies
86119

87120
### Android Dependencies

0 commit comments

Comments
 (0)