What does b stand for, and what is the syntax behind b+sr+Latn?
Asked Answered
N

2

18

By default, Android has always displayed Serbian in Cyrillic, but since 7.0, users can choose between Cyrillic and Latin script. Apps (mostly from Google) ususally puts the Cyrillic strings in sr and the Latin strings in b+sr+Latn. However, b+sr+Latn is very different from the usual convention of using dashes (e.g. sr-rRS-port).

What does b stand for? What is the syntax, and what more can I specify with this?

Neotype answered 21/3, 2017 at 20:48 Comment(0)
S
1

The "b+" prefix was supported starting in Android 7.0. Prefixing "b+" to a language tag list tells Android that the remaining tags are BCP 47 language tags.

Other answers correctly mention this document, which defines those tags: https://tools.ietf.org/html/bcp47

However, the use of "b+" is not found in that document. The specific meaning behind "b+" is clarified in the Android docs:

To use a BCP 47 language tag, concatenate b+ and a two-letter ISO 639-1 language code, optionally followed by additional subtags separated by +.

source: https://developer.android.com/guide/topics/resources/providing-resources

Other reference in code:

A BCP 47 language tag. The BCP-47 tag uses + instead of - as separators, and has the prefix b+. Therefore, the BCP-47 tag "zh-Hans-CN" would be written as "b+zh+Hans+CN" instead.

source: https://android.googlesource.com/platform/tools/base/+/master/sdk-common/src/main/java/com/android/ide/common/resources/configuration/LocaleQualifier.java

Sistrunk answered 26/3, 2021 at 3:43 Comment(1)
Thank you for covering more details. Yes I failed to include the specific part about Android requiring the b+ part. My answer should be updated to improve the quality of it.Neotype
N
18

It's a BCP 47 language tag. It's starts with b and followed by a language, script, region and variant.
BCP 47 documentation

b+sr+Latn would be Serbian with the Latin script.
b+sr+Latn+RS would be Serbian in Serbia, with the Latin script.

The same can be applied to Azerbaijani:
b+az+Latn – Latin script
b+az+Cyrl – Cyrillic script
b+az+Arab – Arabic script

But you can virtually do any combination possible:
b+ja+Hrkt – Japanese with only Hiragana and Katakana
b+ru+Latn – Russian with the Latin script
b+hu+Hung – Hungarian with the Hungarian Runic script
b+en+Cyrl+US – American English with the Cyrillic script
b+hy+Piqd+DE – German Armenian with the Klingon script
(but support will be very limited)

See also:
ISO 639-3 language list
ISO 15924 script list
ISO 3166-1 alpha-2 country list

Neotype answered 21/3, 2017 at 20:48 Comment(0)
S
1

The "b+" prefix was supported starting in Android 7.0. Prefixing "b+" to a language tag list tells Android that the remaining tags are BCP 47 language tags.

Other answers correctly mention this document, which defines those tags: https://tools.ietf.org/html/bcp47

However, the use of "b+" is not found in that document. The specific meaning behind "b+" is clarified in the Android docs:

To use a BCP 47 language tag, concatenate b+ and a two-letter ISO 639-1 language code, optionally followed by additional subtags separated by +.

source: https://developer.android.com/guide/topics/resources/providing-resources

Other reference in code:

A BCP 47 language tag. The BCP-47 tag uses + instead of - as separators, and has the prefix b+. Therefore, the BCP-47 tag "zh-Hans-CN" would be written as "b+zh+Hans+CN" instead.

source: https://android.googlesource.com/platform/tools/base/+/master/sdk-common/src/main/java/com/android/ide/common/resources/configuration/LocaleQualifier.java

Sistrunk answered 26/3, 2021 at 3:43 Comment(1)
Thank you for covering more details. Yes I failed to include the specific part about Android requiring the b+ part. My answer should be updated to improve the quality of it.Neotype

© 2022 - 2024 — McMap. All rights reserved.