Language selection and suggestion UX improvements (#9067)
* feat: don't retain accepted language suggestion after finishing or exiting post (#8886) * feat: don't retain accepted language suggestion after finishing or exiting post * fix: rebase fixes * fix: rebase fixes * chore: lint * Rename onChange for clarity * Improve logic in composer * Handle user override more explicitly * Drill in onSelectLanguage callback into dialog too * Fix typo Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Make text crystal clear * Handle multiple languages --------- Co-authored-by: Elijah Seed-Arita <elijaharita@gmail.com> Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
This commit is contained in:
@@ -71,7 +71,7 @@ const schema = z.object({
|
||||
contentLanguages: z.array(z.string()),
|
||||
/**
|
||||
* The language(s) the user is currently posting in, configured within the
|
||||
* composer. Multiple languages are psearate by commas.
|
||||
* composer. Multiple languages are separated by commas.
|
||||
*
|
||||
* BCP-47 2-letter language code without region.
|
||||
*/
|
||||
|
||||
@@ -156,6 +156,10 @@ export function toPostLanguages(postLanguage: string): string[] {
|
||||
return postLanguage.split(',').filter(Boolean)
|
||||
}
|
||||
|
||||
export function fromPostLanguages(languages: string[]): string {
|
||||
return languages.filter(Boolean).join(',')
|
||||
}
|
||||
|
||||
export function hasPostLanguage(postLanguage: string, code2: string): boolean {
|
||||
return toPostLanguages(postLanguage).includes(code2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user