0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00

Add International Phonetic Alphabet as a note field language hint option

This wasn't available from Locale.getAvailableLocales() but creating a new locale using "und-fonipa" as a language tag
seems to be understood as IPA. Will appear in the language hint dialog as "IPA Phonetics" and will work with GBoard.

See https://en.wikipedia.org/wiki/International_Phonetic_Alphabet#IETF_language_tags
This commit is contained in:
lukstbit 2023-05-17 18:26:56 +03:00 committed by Brayan Oliveira
parent a064351ca1
commit 66320038eb

View File

@ -69,7 +69,7 @@ class LocaleSelectionDialog : AnalyticsDialogFragment() {
val activity: Activity = requireActivity()
val tagsDialogView = LayoutInflater.from(activity)
.inflate(R.layout.locale_selection_dialog, activity.findViewById(R.id.root_layout), false)
val adapter = LocaleListAdapter(Locale.getAvailableLocales())
val adapter = LocaleListAdapter(Locale.getAvailableLocales() + IPALanguage)
setupRecyclerView(activity, tagsDialogView, adapter)
inflateMenu(tagsDialogView, adapter)
@ -173,6 +173,15 @@ class LocaleSelectionDialog : AnalyticsDialogFragment() {
}
companion object {
/**
* Language identifier for International Phonetic Alphabet. This isn't available from [Locale.getAvailableLocales], but
* GBoard seems to understand this as a language code.
*
* See issue #13883
* See https://en.wikipedia.org/wiki/International_Phonetic_Alphabet#IETF_language_tags
*/
private val IPALanguage = Locale.Builder().setLanguageTag("und-fonipa").build()
/**
* @param handler Marker interface to enforce the convention the caller implementing LocaleSelectionDialogHandler
*/