Suggest post language correction (#2486)
* feat: suggested language * fix: wording correction * Factor out SuggestedLanguage into a separate component * Tighten the language-suggestion confidence to avoid false positives * Tweak the copy and UI * Add function fallbacks for safari --------- Co-authored-by: Mary <pineapplecreamcheese@skiff.com>
This commit is contained in:
parent
998ee29986
commit
95d771b3a5
3 changed files with 111 additions and 0 deletions
|
@ -22,6 +22,14 @@ export function code3ToCode2(lang: string): string {
|
|||
return lang
|
||||
}
|
||||
|
||||
export function code3ToCode2Strict(lang: string): string | undefined {
|
||||
if (lang.length === 3) {
|
||||
return LANGUAGES_MAP_CODE3[lang]?.code2
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function codeToLanguageName(lang: string): string {
|
||||
const lang2 = code3ToCode2(lang)
|
||||
return LANGUAGES_MAP_CODE2[lang2]?.name || lang
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue