Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [XML Attrs](https://developer.android.com/reference/android/app/LocaleConfig#lattrs) \| [Constants](https://developer.android.com/reference/android/app/LocaleConfig#constants) \| [Inherited Constants](https://developer.android.com/reference/android/app/LocaleConfig#inhconstants) \| [Fields](https://developer.android.com/reference/android/app/LocaleConfig#lfields) \| [Ctors](https://developer.android.com/reference/android/app/LocaleConfig#pubctors) \| [Methods](https://developer.android.com/reference/android/app/LocaleConfig#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/LocaleConfig#inhmethods)

# LocaleConfig

*** ** * ** ***


`
public


class
LocaleConfig
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.LocaleConfig |

<br />

*** ** * ** ***

The LocaleConfig of an application.
There are two sources. One is from an XML resource file with an `<locale-config>` element
and referenced in the manifest via `android:localeConfig` on `<application>`. The
other is that the application dynamically provides an override version which is persisted in
`https://developer.android.com/reference/android/app/LocaleManager#setOverrideLocaleConfig(android.app.LocaleConfig)`.

For more information about the LocaleConfig from an XML resource file, see
[the section on per-app language preferences](https://developer.android.com/about/versions/13/features/app-languages#use-localeconfig).

## Summary

| ### XML attributes ||
|---|---|
| [`android:localeConfig`](https://developer.android.com/reference/android/app/LocaleConfig#attr_android:localeConfig) | An XML resource with the application's `https://developer.android.com/reference/android/app/LocaleConfig` May be a reference to another resource, in the form "`@[+][*package*:]*type*/*name*`" or a theme attribute in the form "`?[*package*:]*type*/*name*`". |
| [`android:name`](https://developer.android.com/reference/android/app/LocaleConfig#attr_android:name) | The [IETF BCP47 language tag](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) of the supported locale. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_NOT_SPECIFIED` No android:localeConfig tag on . |
| `int` | `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_PARSING_FAILED` Malformed input in the XML file where the LocaleConfig was stored. |
| `int` | `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_SUCCESS` succeeded reading the LocaleConfig structure stored in an XML file. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/app/LocaleConfig#TAG_LOCALE` |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/app/LocaleConfig#TAG_LOCALE_CONFIG` |

| ### Inherited constants |
|---|
| From interface `https://developer.android.com/reference/android/os/Parcelable` |---|---| | `int` | `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. | | `int` | `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/app/LocaleConfig>` | `https://developer.android.com/reference/android/app/LocaleConfig#CREATOR` |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/LocaleConfig#LocaleConfig(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Returns an override LocaleConfig if it has been set via `https://developer.android.com/reference/android/app/LocaleManager#setOverrideLocaleConfig(android.app.LocaleConfig)`. |
| ` https://developer.android.com/reference/android/app/LocaleConfig#LocaleConfig(android.os.LocaleList)(https://developer.android.com/reference/android/os/LocaleList locales) ` Return the LocaleConfig with any sequence of locales combined into a `https://developer.android.com/reference/android/os/LocaleList`. |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/app/LocaleConfig#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` static https://developer.android.com/reference/android/app/LocaleConfig` | ` https://developer.android.com/reference/android/app/LocaleConfig#fromContextIgnoringOverride(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Returns a LocaleConfig from the application resources regardless of whether any LocaleConfig is overridden via `https://developer.android.com/reference/android/app/LocaleManager#setOverrideLocaleConfig(android.app.LocaleConfig)`. |
| ` https://developer.android.com/reference/java/util/Locale` | ` https://developer.android.com/reference/android/app/LocaleConfig#getDefaultLocale()() ` Returns the locale the strings in values/strings.xml (the default strings in the directory with no locale qualifier) are in if specified, otherwise null |
| ` int` | ` https://developer.android.com/reference/android/app/LocaleConfig#getStatus()() ` Get the status of reading the resource file where the LocaleConfig was stored. |
| ` https://developer.android.com/reference/android/os/LocaleList` | ` https://developer.android.com/reference/android/app/LocaleConfig#getSupportedLocales()() ` Returns the locales supported by the specified application. |
| ` void` | ` https://developer.android.com/reference/android/app/LocaleConfig#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/os/Parcelable ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | | ` abstract void` | ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. | ||

## XML attributes

### android:localeConfig

An XML resource with the application's `https://developer.android.com/reference/android/app/LocaleConfig`

May be a reference to another resource, in the form
"`@[+][*package*:]*type*/*name*`" or a theme
attribute in the form
"`?[*package*:]*type*/*name*`".

<br />

### android:name

The [IETF BCP47 language tag](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
of the supported locale. `https://developer.android.com/reference/android/app/LocaleConfig`

May be a string value, using '\\\\;' to escape characters such as
'\\\\n' or '\\\\uxxxx' for a unicode character;

<br />

## Constants

### STATUS_NOT_SPECIFIED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATUS_NOT_SPECIFIED
```

No android:localeConfig tag on .

<br />

Constant Value:

1
(0x00000001)


### STATUS_PARSING_FAILED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATUS_PARSING_FAILED
```

Malformed input in the XML file where the LocaleConfig was stored.

<br />

Constant Value:

2
(0x00000002)


### STATUS_SUCCESS

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATUS_SUCCESS
```

succeeded reading the LocaleConfig structure stored in an XML file.

<br />

Constant Value:

0
(0x00000000)


### TAG_LOCALE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String TAG_LOCALE
```

<br />

<br />

Constant Value:

"locale"


### TAG_LOCALE_CONFIG

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String TAG_LOCALE_CONFIG
```

<br />

<br />

Constant Value:

"locale-config"


## Fields

### CREATOR

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<LocaleConfig> CREATOR
```

<br />

<br />

## Public constructors

### LocaleConfig

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LocaleConfig (Context context)
```

Returns an override LocaleConfig if it has been set via
`https://developer.android.com/reference/android/app/LocaleManager#setOverrideLocaleConfig(android.app.LocaleConfig)`. Otherwise, returns the
LocaleConfig from the application resources.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the context of the application. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/Context#createPackageContext(java.lang.String,%20int)`

### LocaleConfig

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LocaleConfig (LocaleList locales)
```

Return the LocaleConfig with any sequence of locales combined into a `https://developer.android.com/reference/android/os/LocaleList`.

**Note:** Applications seeking to create an override LocaleConfig via
`https://developer.android.com/reference/android/app/LocaleManager#setOverrideLocaleConfig(android.app.LocaleConfig)` should use this constructor to
first create the LocaleConfig they intend the system to see as the override.

**Note:** The creation of this LocaleConfig does not automatically mean it will
become the override config for an application. Any LocaleConfig desired to be the override
must be passed into the `https://developer.android.com/reference/android/app/LocaleManager#setOverrideLocaleConfig(android.app.LocaleConfig)`,
otherwise it will not persist or affect the system's understanding of app-supported
resources.

<br />

| Parameters ||
|---|---|
| `locales` | `LocaleList`: the desired locales for a specified application. This value cannot be `null`. <br /> |

## Public methods

### describeContents

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### fromContextIgnoringOverride

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static LocaleConfig fromContextIgnoringOverride (Context context)
```

Returns a LocaleConfig from the application resources regardless of whether any LocaleConfig
is overridden via `https://developer.android.com/reference/android/app/LocaleManager#setOverrideLocaleConfig(android.app.LocaleConfig)`.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the context of the application. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/LocaleConfig` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/Context#createPackageContext(java.lang.String,%20int)`

### getDefaultLocale

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Locale getDefaultLocale ()
```

Returns the locale the strings in values/strings.xml (the default strings in the directory
with no locale qualifier) are in if specified, otherwise null

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Locale` | The default Locale or null <br /> |

### getStatus

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getStatus ()
```

Get the status of reading the resource file where the LocaleConfig was stored.

Distinguish "the application didn't provide the resource file" from "the application
provided malformed input" if `https://developer.android.com/reference/android/app/LocaleConfig#getSupportedLocales()` returns `null`.

<br />

| Returns ||
|---|---|
| `int` | `STATUS_SUCCESS` if the LocaleConfig structure existed in an XML file was successfully read, or `STATUS_NOT_SPECIFIED` if no android:localeConfig tag on pointing to an XML file that stores the LocaleConfig, or `STATUS_PARSING_FAILED` if the application provided malformed input for the LocaleConfig structure. Value is one of the following: - `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_SUCCESS` - `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_NOT_SPECIFIED` - `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_PARSING_FAILED` |

**See also:**

- `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_SUCCESS`
- `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_NOT_SPECIFIED`
- `https://developer.android.com/reference/android/app/LocaleConfig#STATUS_PARSING_FAILED`

### getSupportedLocales

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LocaleList getSupportedLocales ()
```

Returns the locales supported by the specified application.

**Note:** The locale format should follow the
[IETF BCP47 regular expression](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/LocaleList` | the `https://developer.android.com/reference/android/os/LocaleList` This value may be `null`. <br /> |

### writeToParcel

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |