A simple CLI tool for managing app localizations for iOS and Android projects using Capacitor or Cordova.
npm install app-localization-cliA simple CLI tool for managing app localizations for iOS and Android projects using Capacitor or Cordova.
π± iOS & Android Support
π Automatic Resource Updates
π Multiple Language Support
β‘οΈ Easy to Use
- AcuNote: Acupuncture and Meridian points learning app.
- W3S: Easy frontend tutorials for beginners.
- Classical Chinese: Learn Classical Chinese Easily.
- Style Rater: Meet Your Better Self!
- Chinese Meal: Chinese Vegetarian Cuisine Guide.
- Welcome to add your app here...
No installation needed! Just run with npx:
``bash`
npx app-localization-cli
Or install globally if you prefer:
`bash`
npm install -g app-localization-cli
update-localizations
Your project should look like this:
``
your-project/
βββ localizations/ # Your localization configs
β βββ en.json
β βββ zh-Hans.json
β βββ zh-Hant.json
βββ ios/ # iOS project directory
β βββ App/
β βββ App/
β β βββ Info.plist
β β βββ en.lproj/
β β βββ zh-Hans.lproj/
β β βββ zh-Hant.lproj/
β βββ App.xcodeproj/
β βββ project.pbxproj
βββ android/ # Android project directory
βββ app/
βββ src/
βββ main/
βββ res/
βββ values/
β βββ strings.xml
βββ values-zh-rCN/
β βββ strings.xml
βββ values-zh-rTW/
βββ strings.xml
Create JSON files in the localizations directory for each language:
π localizations/en.json:
`json`
{
"ios": {
"CFBundleDisplayName": "My App"
},
"android": {
"title_activity_main": "My App"
}
}
π localizations/zh-Hans.json:
`json`
{
"ios": {
"CFBundleDisplayName": "ζηεΊη¨"
},
"android": {
"title_activity_main": "ζηεΊη¨"
}
}
`bashUpdate both platforms
npx app-localization-cli
How It Works
$3
1. Creates
.lproj directories for each language
2. Generates InfoPlist.strings files with localized values
3. Updates Info.plist to add CFBundleLocalizations and CFBundleDevelopmentRegion localizations values
4. Updates Xcode project configuration to include new languagesExample iOS output:
`
MyApp/
βββ en.lproj/
β βββ InfoPlist.strings # CFBundleDisplayName = "My App";
βββ zh-Hans.lproj/
β βββ InfoPlist.strings # CFBundleDisplayName = "ζηεΊη¨";
βββ Info.plist # CFBundleDisplayName = "My App";
`$3
1. Creates
values-* directories for each language
2. Generates or updates strings.xml files
3. Preserves existing string resources
4. Handles XML escaping automaticallyExample Android output:
`
res/
βββ values/
β βββ strings.xml # My App
βββ values-zh-rCN/
βββ strings.xml # ζηεΊη¨
`Supported Keys
$3
| Key | Description |
| --------------------- | ------------------------ |
|
CFBundleDisplayName | App name shown on device |
| ... | Any string resource |$3
| Key | Description |
| --------------------- | ------------------- |
|
title_activity_main | Application title |
| ... | Any string resource |Language Code Mapping
| Language | iOS Code | Android Code |
| ------------------- | --------- | ------------------------------------------------- |
| English |
en | values |
| Simplified Chinese | zh-Hans | values-zh-rCN |
| Traditional Chinese | zh-Hant | values-zh-rTW, values-zh-rHK, values-zh-rMO |
| Other Languages | ... | ... |Troubleshooting
$3
1. NSUserTrackingUsageDescription is empty after build
Set a default value for
NSUserTrackingUsageDescription in Info.plist.
Otherwise, it will be empty after build in CFBundleDevelopmentRegion language.2. Files Not Updated
`bash
# Check if localizations directory exists
ls localizations/*.json # Verify file permissions
ls -l ios/App/App
ls -l android/app/src/main/res
`3. Wrong Directory Structure
`bash
# Should be in project root
npx app-localization-cli --help
`4. Invalid JSON Format
`bash
# Validate JSON files
cat localizations/*.json | jq '.'
`$3
`bash
Run with debug output
DEBUG=true npx app-localization-cli
``MIT