app-localization-cli v1.0.14
App Localization CLI (ALC)
A simple CLI tool for managing app localizations for iOS and Android projects using Capacitor or Cordova.
Features
π± iOS & Android Support
π Automatic Resource Updates
π Multiple Language Support
β‘οΈ Easy to Use
Apps use ALC
- AcuNote: Acupuncture and Meridian points learning app.
- W3S: Easy frontend tutorials for beginners.
- Classical Chinese: Learn Classical Chinese Easily.
- Welcome to add your app here...
Installation & Usage
No installation needed! Just run with npx:
npx app-localization-cli
Or install globally if you prefer:
npm install -g app-localization-cli
update-localizations
Project Structure
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
Configuration
1. Create Localization Files
Create JSON files in the localizations
directory for each language:
π localizations/en.json
:
{
"ios": {
"CFBundleDisplayName": "My App"
},
"android": {
"title_activity_main": "My App"
}
}
π localizations/zh-Hans.json
:
{
"ios": {
"CFBundleDisplayName": "ζηεΊη¨"
},
"android": {
"title_activity_main": "ζηεΊη¨"
}
}
2. Run the Tool
# Update both platforms
npx app-localization-cli
# Or update specific platform
npx app-localization-cli --platform ios
npx app-localization-cli --platform android
How It Works
iOS
- Creates
.lproj
directories for each language - Generates
InfoPlist.strings
files with localized values - Updates
Info.plist
to add CFBundleLocalizations and CFBundleDevelopmentRegion localizations values - Updates Xcode project configuration to include new languages
Example iOS output:
MyApp/
βββ en.lproj/
β βββ InfoPlist.strings # CFBundleDisplayName = "My App";
βββ zh-Hans.lproj/
β βββ InfoPlist.strings # CFBundleDisplayName = "ζηεΊη¨";
βββ Info.plist # CFBundleDisplayName = "My App";
Android
- Creates
values-*
directories for each language - Generates or updates
strings.xml
files - Preserves existing string resources
- Handles XML escaping automatically
Example Android output:
res/
βββ values/
β βββ strings.xml # <string name="title_activity_main">My App</string>
βββ values-zh-rCN/
βββ strings.xml # <string name="title_activity_main">ζηεΊη¨</string>
Supported Keys
iOS
Key | Description |
---|---|
CFBundleDisplayName | App name shown on device |
... | Any string resource |
Android
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
Common Issues
NSUserTrackingUsageDescription is empty after build
Set a default value for
NSUserTrackingUsageDescription
inInfo.plist
. Otherwise, it will be empty after build inCFBundleDevelopmentRegion
language.Files Not Updated
# Check if localizations directory exists ls localizations/*.json # Verify file permissions ls -l ios/App/App ls -l android/app/src/main/res
Wrong Directory Structure
# Should be in project root npx app-localization-cli --help
Invalid JSON Format
# Validate JSON files cat localizations/*.json | jq '.'
Debug Mode
# Run with debug output
DEBUG=true npx app-localization-cli
License
MIT