Login Account

Android XML Resources Example Translated with doloc

Doloc offers a streamlined approach to localizing your application’s content. By utilizing its API, you can efficiently translate your Android XML Resources into multiple languages. Here’s an example to illustrate the process:

Original Android XML Resources Files BEFORE localization

Original Android XML Resources File and existing translated Andorid XML Resource File:

res/values/strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="welcome">Ahoy there!</string>
    <string name="description">Innovation at your fingertips, shaping tomorrow today.</string>
    <string name="footer">Don’t miss out, be a part of the future.</string>
    <string name="contact">Let’s get the ball rolling, we’re just a message away!</string>
    <string name="terms">If you proceed, you accept the mysteries that lie ahead.</string>
</resources>

res/values-de/strings.xml

<resources>
	<string name="welcome">Ahoi!</string>
	<string name="description">Innovation zum Greifen nah bei dir, heute schon das morgen gestalten.</string>
</resources>

Running the doloc curl command

To translate this file into German using doloc’s API, execute the following curl command (be sure to get your $API_TOKEN in your doloc account):

curl "https://api.doloc.io?sourceLang=en&targetLang=de" -H "Authorization: Bearer $API_TOKEN" -F source="@res/values/strings.xml" -F target="@res/values-de/strings.xml" -o res/values-de/strings.xml

Note: For further customization, refer to the options you can pass as query parameters in the URL! This allows you to tailor the experience to your needs.

Android XML Resources file AFTER localization

After running the command, the translated Android XML Resources file will appear as follows:

res/values-de/strings.xml

<resources>
	<string name="welcome">Ahoi!</string>
	<string name="description">Innovation zum Greifen nah bei dir, heute schon das morgen gestalten.</string>
	<string name="footer">Verpasse es nicht, sei ein Teil der Zukunft.</string>
	<string name="terms">Wenn du fortfährst, akzeptierst du die Geheimnisse, die vor dir liegen.</string>
	<string name="contact">Lass uns ins Rollen kommen, wir sind nur eine Nachricht entfernt!</string>
</resources>

All new texts are also translated according to existing translations. E.g. informal "you" of name="description" translation is respected.
This process demonstrates how doloc can seamlessly integrate into your development workflow, providing instant translations and accelerating your application’s localization.

Getting started with Android XML Resources localization

Ready to get started with doloc? It is only three steps:

  1. Register now!
  2. Create your personal $API_TOKEN
  3. Add the curl command (see above) to your dev workflow.

Make sure to check out our dedicated Andorid Guide and complete Android XML Resources Format Documentation.