Android Localization
As you know, Android localized strings are stored in xml files that contains <key>value</key> values:
<?xml version="1.0" encoding="UTF-8"?> <resources> <string name="hello">Hello</string> <string name="world">World</string> </resources>
Whenever you want you can extract localized strings from our service to your Android project.
You can do it manually via web-interface, using API, or shell script.
Web-interface
Open you project settings, select [Android localized strings], choose a language and click export.
API
val queue = Volley.newRequestQueue(this) val url = "http://api.localize.to/v1/en?format=android&apikey=YOUR_PROJECT_API_KEY" val stringRequest = StringRequest(Request.Method.GET, url, Response.Listener{ response -> print(response) }, Response.ErrorListener { print("error") }) queue.add(stringRequest)
Shell script
Example below downloads six different languages to the app/src/main/res/ folder.
#!/bin/sh target_path="app/src/main/res" apikey="{YOUR_PROJECT_API_KEY}" base_url="https://localize.to/api/v1" declare -a langs=("en" "ru" "uk" "de" "fr" "es") for lang in "${langs[@]}" do echo $lang name="${target_path}/values-${lang}/strings.xml" request="${base_url}/language/${lang}?apikey=${apikey}&format=android" curl -o ${name} ${request} done cp "${target_path}/values-en/strings.xml" "${target_path}/values/strings.xml"