PHPackages                             developernauts/nativephp-mobile-locales - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. developernauts/nativephp-mobile-locales

ActiveNativephp-plugin[Localization &amp; i18n](/categories/localization)

developernauts/nativephp-mobile-locales
=======================================

A NativePHP plugin for managing supported locales and syncing language preferences between mobile apps and Laravel.

v1.0.1(1w ago)1105↓37.5%1MITPHPPHP ^8.3

Since Apr 16Pushed 1w agoCompare

[ Source](https://github.com/developernauts/nativephp-mobile-locales)[ Packagist](https://packagist.org/packages/developernauts/nativephp-mobile-locales)[ Docs](https://github.com/developernauts/nativephp-mobile-locales)[ RSS](/packages/developernauts-nativephp-mobile-locales/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

NativePHP Mobile Locales
========================

[](#nativephp-mobile-locales)

[![Latest Version on Packagist](https://camo.githubusercontent.com/777a0b4e3eaa92015658be8e3dc87bdb1bccd831e543d9df008d163a83cb3d9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646576656c6f7065726e617574732f6e61746976657068702d6d6f62696c652d6c6f63616c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/developernauts/nativephp-mobile-locales)[![Total Downloads](https://camo.githubusercontent.com/d01273a105bcf787b58ad585830cd4654b21b0994906cc16775bff41d9468c01/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576656c6f7065726e617574732f6e61746976657068702d6d6f62696c652d6c6f63616c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/developernauts/nativephp-mobile-locales)

Declare the locales your NativePHP mobile app supports — once — and have the plugin wire the platform-native configuration on every iOS and Android build.

> **Build-time only.** This plugin runs during `php artisan native:run`. It writes native config files into the generated iOS and Android projects. It does **not** run at runtime, ship translations, switch locales, or persist user preferences.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel &gt;= 12
- NativePHP Mobile v3

Features
--------

[](#features)

- Single source of truth for supported locales — one config array, both platforms.
- iOS: writes `CFBundleLocalizations` into `Info.plist`.
- Android: generates `res/xml/locales_config.xml` and references it from `AndroidManifest.xml`.
- Automatic format conversion (BCP 47 in, platform-native out).
- Idempotent — repeated builds produce the same output.

Installation
------------

[](#installation)

```
composer require developernauts/nativephp-mobile-locales
```

Register the plugin with NativePHP:

```
php artisan native:plugin:register developernauts/nativephp-mobile-locales
```

Publish the config file:

```
php artisan vendor:publish --tag=nativephp-mobile-locales-config
```

Configuration
-------------

[](#configuration)

`config/mobile-locales.php`

```
return [
    'locales' => [
        'en',
        'en-GB',
    ],
];
```

Use [BCP 47](https://www.rfc-editor.org/rfc/rfc5646) tags (`en`, `pt-BR`, `en-GB`). Region subtags are optional. Tags are normalized automatically — `en_gb`, `EN-GB`, and `en-GB` resolve to the same entry.

Native Platform Language Support
--------------------------------

[](#native-platform-language-support)

The plugin automatically syncs your configured locales into the native iOS and Android projects so the operating system can properly recognise which languages your app supports — without any manual Xcode or Android Studio configuration.

### iOS App Store Language Display

[](#ios-app-store-language-display)

iOS reads the `CFBundleLocalizations` entries written to `Info.plist` and surfaces them in Settings and on the App Store listing.

[![iOS language settings showing supported app languages](https://private-user-images.githubusercontent.com/39984416/593496505-be09b8c3-831c-456e-a788-dffce15f68c3.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODA5NzQ4ODUsIm5iZiI6MTc4MDk3NDU4NSwicGF0aCI6Ii8zOTk4NDQxNi81OTM0OTY1MDUtYmUwOWI4YzMtODMxYy00NTZlLWE3ODgtZGZmY2UxNWY2OGMzLnB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ZGJmNjRlNGI5Yjg5YTQ2Yjc5NGFjZjhmYzNjZGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.xXY8OIhLAainVro8DNCHDaNjGmV2Stdhi4WlEyVAACo)

[![iOS App Store language list populated from configured locales](https://private-user-images.githubusercontent.com/39984416/593496614-1eebfc53-42cf-432d-9927-985780cc1412.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODA5NzQ4ODUsIm5iZiI6MTc4MDk3NDU4NSwicGF0aCI6Ii8zOTk4NDQxNi81OTM0OTY2MTQtMWVlYmZjNTMtNDJjZi00MzJkLTk5MjctOTg1NzgwY2MxNDEyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjA5VDAzMDk0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFlMzkwZjJhZTg5OGM5OWFhNDI1OTc0OTE5MWJlNjM5MmM4ODU5ODFhNDY4ZTE1Y2E2OTA5M2Y4NWM4OTdlMTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.I62UCqPhGu6E9yiYkN33Emn_HwMXX1_CUHMO9WGHy6o)](https://private-user-images.githubusercontent.com/39984416/593496614-1eebfc53-42cf-432d-9927-985780cc1412.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODA5NzQ4ODUsIm5iZiI6MTc4MDk3NDU4NSwicGF0aCI6Ii8zOTk4NDQxNi81OTM0OTY2MTQtMWVlYmZjNTMtNDJjZi00MzJkLTk5MjctOTg1NzgwY2MxNDEyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjA5VDAzMDk0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFlMzkwZjJhZTg5OGM5OWFhNDI1OTc0OTE5MWJlNjM5MmM4ODU5ODFhNDY4ZTE1Y2E2OTA5M2Y4NWM4OTdlMTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.I62UCqPhGu6E9yiYkN33Emn_HwMXX1_CUHMO9WGHy6o)

### Android App Language Support

[](#android-app-language-support)

Android 13+ uses `locales_config.xml` to populate the per-app language picker in system Settings, allowing users to override the app language independently of the system locale.

[![Android per-app language settings populated from locale_config.xml](https://private-user-images.githubusercontent.com/39984416/593496683-351a60a1-44f3-410d-9e92-1424a903efde.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODA5NzQ4ODUsIm5iZiI6MTc4MDk3NDU4NSwicGF0aCI6Ii8zOTk4NDQxNi81OTM0OTY2ODMtMzUxYTYwYTEtNDRmMy00MTBkLTllO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DBkNTRkYjc3MzYwMTAwZWI3YWJhNzU4MWU2MTQ0MWRmMzcxOGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.R5Rll_weJirf1AOC7nvIsnGfbhborsZKEz7oRsv_5AI)---

When are locale files generated?
--------------------------------

[](#when-are-locale-files-generated)

The sync commands run automatically as a `pre_compile` plugin hook during:

- `php artisan native:run` (iOS and Android)
- `php artisan native:build` (iOS)
- `php artisan native:bundle` (iOS and Android)

After `native:install --force` the native project files are reset to their template state. The locale files will be restored on the next build/run/bundle.

Generating locale files locally
-------------------------------

[](#generating-locale-files-locally)

To inspect or verify the generated files without running a full build, the sync commands can be run directly:

```
# Sync all platforms
php artisan nativephp-mobile-locales:sync

# iOS only — updates nativephp/ios/NativePHP/Info.plist and nativephp/ios/NativePHP-simulator-Info.plist
php artisan nativephp-mobile-locales:sync-ios

# Android only — creates nativephp/android/app/src/main/res/xml/locales_config.xml
php artisan nativephp-mobile-locales:sync-android

# Android manifest only — adds android:localeConfig to AndroidManifest.xml
php artisan nativephp-mobile-locales:sync-android-manifest
```

How it works
------------

[](#how-it-works)

On every build, the plugin reads the `locales` array and writes the platform-native equivalent into the generated native projects.

### iOS

[](#ios)

`nativephp/ios/NativePHP/Info.plist`

```
CFBundleLocalizations

    en
    en-GB

```

### Android

[](#android)

`nativephp/android/app/src/main/res/xml/locales_config.xml`

```

```

`nativephp/android/app/src/main/AndroidManifest.xml`

```

```

BCP 47 (`en-GB`) is automatically converted to Android's resource qualifier format (`en-rGB`). Keep your config in BCP 47.

Testing
-------

[](#testing)

```
composer test
```

The test suite covers locale normalisation, BCP 47 → platform-native format conversion, XML write/update logic for all three config files, platform routing, and idempotency.

Notes
-----

[](#notes)

Note

Running `php artisan native:plugin:validate` will report two warnings for this plugin:

- *No bridge\_functions defined in manifest*
- *No native code directories found (resources/android or resources/ios)*

Both are expected. This plugin ships no bridge functions and no native code — it works entirely through a `pre_compile` hook that writes config files into the generated native projects. The warnings do not affect functionality.

- Per-app language preferences on Android 13+ require both `locales_config.xml` and the manifest reference — both handled here.
- iOS reads `CFBundleLocalizations` at build time; rebuild after changing the config.
- An empty `locales` array is a valid no-op.
- Only two-part BCP 47 tags are supported (`en`, `en-GB`). Three-part tags such as `zh-Hans-CN` are rejected with an `InvalidArgumentException`.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md).

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance98

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Total

2

Last Release

13d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a908ca043edcb574827c804eb10ba685e2d741379e683851c4c9b5f55c85925f?d=identicon)[developernauts](/maintainers/developernauts)

---

Top Contributors

[![migsAV](https://avatars.githubusercontent.com/u/39984416?v=4)](https://github.com/migsAV "migsAV (8 commits)")[![wilsonatb](https://avatars.githubusercontent.com/u/55840381?v=4)](https://github.com/wilsonatb "wilsonatb (1 commits)")

---

Tags

laravelmobilelocalesnativephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/developernauts-nativephp-mobile-locales/health.svg)

```
[![Health](https://phpackages.com/badges/developernauts-nativephp-mobile-locales/health.svg)](https://phpackages.com/packages/developernauts-nativephp-mobile-locales)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4721.5k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
