The core is TransliteratorRegistry.find, which calls TransliteratorRegistry.Spec, which does a fallback.
for each target fallback, it does all the source fallbacks. So
However, it only does script fallback for locales that ICU has, and it doesn't try multiple scripts.
A. It should use the language -> default script mapping from LikelySubtags instead of the ICU locales.
B. The fallback needs to take BCP47 into account, but with the final item being script.
az-Cyrl-FOO => az-Cyrl => az => Cyrl
The code und will then work.
und-Cyrl => und => Cyrl
C. where we have very closely related codes, we should try them before we fall back to the script.
nn -> nb -> no -> Latn
D. Multiple Scripts
(where we don't have language-specific translits)
If, say, az is written with Cyrl and Latn, then az-el is really a request to convert any of the Azeri characters (Cyrl, Latn, or Arab) to the default script for Greek. So if we don't have a specific az transliterator, we should ideally use a compound:
On the other hand, the target side is simple. That is, el-az would be
Again, using the LikelySubtags to get the default script for az.
In the short term, we might just do the same on the source side, since that is an easier fix.
Typo in numbering above, has A, C, D, D. Middle two should be B, C.
This popped up again in a bug that Andy ran into; the current fallback structure is fragile, and needs this fixed.
We need to update this for some of the changes in CLDR, notably:
und-Deva, Deva, Devanagari should all be handled as the same
(May add other requirements as we make progress in CLDR.)
This does not look "sensitive".