An exporter script for Localise.biz projects for iOS and Android projects
TODO
Add this to your Podfile, then run pod install
pod 'LocoMobileExport'
To integrate automatic update the .strings files when you build the project everytime, please follow below steps:
- Go to
YOUR TARGET
->Build Settings
, add anUser Defined Settings
- Set key to
LOCO_API_KEY
and paste in the API Key value from your Localise.biz project. - Navigate to
Build Phases
, add a run script.
SCRIPT=$PODS_ROOT/LocoMobileExport/Sources/auto_export.sh
#Need to config the options, see below
$SCRIPT ios --key $LOCO_API_KEY --map 'en=en' --map 'zh=zh-Hant' --output "$PROJECT_DIR/{path_to_lproj_dir}}"
- Build the project and see the magic!
- Download the latest release, unzip it to your project root or anywhere you prefer.
- Create a bash script in your project root, e.g.
updateLoco.sh
- Make it executable by
chmod +x updateLoco.sh
- Paste script and modify it to match your project
KEY=YOUR_API_KEY_HERE #1)Change this
SCRIPT=LocoMobileExport/Sources/auto_export.sh #2)..and this
#3)..and the map arguments below
$SCRIPT android --key $KEY --map "en_HK=values" --output "${PWD}/app/src/main/res"
- Add these lines in your
Build.gradle
task locoExport(type: Exec) {
doFirst {
workingDir rootProject.projectDir
commandLine "./updateLoco.sh"
}
}
//run task before every build
preBuild.dependsOn(locoExport)
//or you can choose to update loco when you clean the project
//clean.dependsOn(locoExport)
Option | Explanation |
---|---|
{Platform} | ios or android |
--key | Provide the project API Key from localise.biz |
--output | Specific the path of where the .lproj folder is e.g. --output "$PROJECT_DIR/MyApp" |
--map (iOS) | en_US on localise.biz exports, en.lproj in the xcode project, use --map 'en_US=en' , can map as many as you want to meet your project setup. |
--map (Android) | en_US on localise.biz exports, values in the res directory, use --map 'en_US=values' , can map as many as you want to meet your project setup. |
--tags (optional) | Coma separated Loco tags |
--plurals (optional) | true if resources should be exported as plural resource file |
--name (optional) | The name of the strings file. Default is localizable |