Search code examples
androidiosiso-639-2

Getting the device language from iOS and Android in the same format


My team is building an app for Android and iOS. The application receives several notifications from the server, in various forms like push notifications and UI popups.

In order to send the messages in the right language, I would like the apps in both platforms to send me the device language in the same format.

For example, English can be en or eng or even English, but it must be the same for both devices.

Is there a language name format supported by both iOS and Android? If so, what are the calls for the device language in both platforms?


Solution

  • As it turns out, iPhone's IETF BCP 47 language codes can be converted to Android's ISO-639-2 codes.

    I will accept both inputs in their native form and convert iPhone's BCP 47 to ISO-639-2 on the server side.