Localizr is a Tool that handles and automates the generation of localization files for IOS and Android so there will be only one source of truth for all of your localization strings.
MIT License
Localizr is a Tool that handles and automates localization files. Basically we give limited access to the translators to let them input or upload different keystrings and the developer will just fetch it on development or deployment only when if there is an update or changes. This will lessen or prevent the mistake that developer made because he/she has no clue what are those words are and most of them (including me, but not all) are just copy pasting those words (especially when it comes to chinese or japanese characters) from excel to the Localizable.strings via Xcode.
Fastlane actions
. (Fastlane actions localizr
)docker pull michaelhenry119/localizr
username: demo
password: localizr
I have created a demo IOS App, You can pull it from Localizr.swift.
http://{your_server.com}/app/{app_slug}.{locale_code}
By using Fastlane
. Currently localizr
action is not officially available in fastlane
repo, so you have to manually grab it from here fastlane/actions and paste the actions
folder directly to your project 's fastlane
folder in order to make this available to your local.
here is the shortcut:
# from your workplace root folder:
$ curl -o fastlane/actions/localizr.rb https://raw.githubusercontent.com/michaelhenry/Localizr/master/fastlane/actions/localizr.rb
$ fastlane actions localizr
desc "Submit build to TestFlight."
lane :beta do
increment_build_number
# ...
localizr(
localizr_server: 'http://your_localizr_server',
localizr_api_token: 'your-auth-token-from-admin-page',
locale_codes: 'en,ja,pt,zh,es',
localizr_app_slug: 'your-app-slug',
output_target_path: 'ExampleApp',
platform: 'ios',
)
gym
# ...
end
lane :beta do
localizr(
localizr_server: 'http://your_localizr_server',
localizr_api_token: 'your-auth-token-from-admin-page',
locale_codes: 'en,ja,pt,zh,es',
localizr_app_slug: 'your-app-slug',
output_target_path: 'res'
),
gradle(
task: 'assemble',
build_type: 'Release'
)
# ...
end
export FL_LOCALIZR_SERVER='http://your_localizr_server'
export FL_LOCALIZR_API_TOKEN='your-auth-token-from-admin-page'
export FL_LOCALIZR_APP_SLUG='your-app-slug'
export FL_LOCALIZR_BASE_LOCALE_CODE='en'
export FL_LOCALIZR_LOCALE_CODES='en,es,ja,zh,pt'
export FL_LOCALIZR_PLATFORM='ios'
export FL_LOCALIZR_OUTPUT_TARGET_PATH='ExampleApp'
Example:
desc "Submit build to TestFlight."
lane :beta do
increment_build_number
# ...
localizr
gym
# ...
end
This is optional, but you can enable this by providing valid information for the following in the environment variables.
export AWS_ACCESS_KEY_ID='Your aws access key id'
export AWS_SECRET_ACCESS_KEY='Your secret key'
export AWS_STORAGE_BUCKET_NAME='Name of the bucket'
Locales
set the name
and the code
.App
and set the base_locale
if you want to have a fallback for missing localized strings
.Keys
.Keys
with the App
so you can re-use the keys to other apps too.localized strings
.You can find the sample csv files in the sample_data folder.
Locales.csv
to Locales
section.Apps.csv
to Apps
section.App's Keys.csv
to App 's Keys
section.Localized String.csv
to Localized String
section.Just find the EXPORT
button, select the format
and that's it.
Just click this button >++>
If you're using heroku's free dyno and the waking time is longer than expected, you disable the auto migration option by setting the environment variable:
LOCALIZR_DISABLE_AUTO_MIGRATION=1
sample config of docker-compose.yml
version: '3'
services:
db:
image: postgres:9.4
volumes:
- pg-data:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=your_db_password
localizr:
image: michaelhenry119/localizr:latest
container_name: localizr
ports:
- "80:8001"
environment:
# Reference: postgres://USER:PASSWORD@HOST:PORT/NAME, this example is using the default postgres database.
- DATABASE_URL=postgres://postgres:your_db_password@db:5432/postgres
# You have to define your host name here to prevent any random attacks.
- ALLOWED_HOSTS=0.0.0.0,localizr.domain.com,or_any_domain
# This is optional, you can assign a default then change it later from the admin page.
# Or you can do it programatically after you mount the image.
- ADMIN_USERNAME=admin
- ADMIN_PASSWORD=change_me_later
- [email protected]
depends_on:
- db
volumes:
pg-data:
Install virtualenv
$ pip install virtualenv
Create a virtual environment venv
$ virtualenv venv
Activate the virtual environment
$ source venv/bin/activate
Install the dependencies
$ pip install -r requirements_local.txt
Migrate to create a local sqlite database
$ python manage.py migrate --settings=project.settings
Create a super user (login account)
$ python manage.py createsuperuser --settings=project.settings
Run the local server
$ python manage.py runserver --settings=project.settings
open http://127.0.0.1:8000/ from your browser and use the login credentials you provided.
Snapshot is supported by passing a query param ?snapshot=your_any_key_or_build_number
to the localizedkeystrings request.
With using CI
and Fastlane
, create a script or use fastlane actions localizr
to download and update all the localization strings before gym
method, So we can always make sure that all strings are updated.
Michael Henry Pantaleon, [email protected]
Localizr is available under the MIT license. See the LICENSE file for more info.