---
title: Internationalization in Android
description: Learn how to set up basic internationalization using field-level translation within your Android project.
url: https://www.storyblok.com/docs/guides/android/internationalization
---

# Internationalization in Android

Learn how to create a basic implementation of field-level translation in an Android project.

## Setup

In your space, open **Settings** → **Internationalization** → **Languages** and add `es` (Spanish).

-   In the article content type block schema, set the `title` and `content` fields as translatable.
-   Go to each article, select the Spanish language, and provide translated content. You can also use [AI Translations](https://www.storyblok.com/docs/editor-guides/ai-translations).

> [!NOTE]
> Learn more in the [internationalization concept](/docs/concepts/internationalization).

## Use the device locale

Update `MainActivity.kt` to determine the language from the device locale.

app/src/main/java/com/example/myapplication/MainActivity.kt

```kotlin
…
import androidx.navigation3.runtime.entryProvider
import androidx.compose.ui.platform.LocalConfiguration
…
          val backStack = rememberNavBackStack(HomeKey)

          val availableLanguages = arrayOf("es")
          val locale = LocalConfiguration.current.locales
              .getFirstMatch(availableLanguages)

          Storyblok(
            accessToken = "YOUR_ACCESS_TOKEN",
            version = if (BuildConfig.DEBUG) Draft else Published,
            region = EU, // Choose the correct region from your Space.
            language = locale?.language?.takeIf { it in availableLanguages },
            …
          ) {
            …
          }
…
```

First, an array with all language codes configured in the space is defined.

Next, [`getFirstMatch()`](https://developer.android.com/reference/android/os/LocaleList#getFirstMatch\(java.lang.String%5B%5D\)) resolves the best match among the languages available in the space. If the locale match is in our array of available languages, it is passed to the [`Storyblok`](https://storyblok.github.io/storyblok-kotlin/storyblok-compose/com.storyblok.compose/-storyblok.html) composable function via its `language` parameter.

Because `LocalConfiguration` is a composition local, changing the device language triggers a configuration change, and the stories are automatically re-fetched in the newly selected language.

> [!TIP]
> Use the `fallbackLanguage` parameter of the [`Storyblok`](https://storyblok.github.io/storyblok-kotlin/storyblok-compose/com.storyblok.compose/-storyblok.html) composable function to specify which language to fall back to for fields that have not been translated yet.

To test the implementation, change the device language to Spanish under **Settings** → **System** → **Languages**, or add a per-app language preference. The app now renders the translated article content.

> [!NOTE]
> Internationalization is highly implementation-specific. Instead of relying on the device locale, you may, for example, want to offer an in-app language picker and store the selection, passing it as the `language` parameter.

## Related resources

[Concept: Internationalization](/docs/concepts/internationalization)

[Storyblok Composable Function Reference](https://storyblok.github.io/storyblok-kotlin/storyblok-compose/com.storyblok.compose/-storyblok.html)

[Android Developers: Per-App Language Preferences](https://developer.android.com/guide/topics/resources/app-languages)

## Pagination

-   [Previous: Content Modeling in Android](/docs/guides/android/content-modeling)
