diff --git a/composables/settings/definition.ts b/composables/settings/definition.ts index 4f66e9a7..f51423f4 100644 --- a/composables/settings/definition.ts +++ b/composables/settings/definition.ts @@ -13,6 +13,7 @@ export interface WellnessSettings { hideBoostCount: boolean hideFavoriteCount: boolean hideFollowerCount: boolean + useInclusiveWriting: boolean } export interface UserSettings { @@ -38,6 +39,7 @@ export const DEFAULT_WELLNESS_SETTINGS: WellnessSettings = { hideBoostCount: false, hideFavoriteCount: false, hideFollowerCount: false, + useInclusiveWriting: true, } export const DEFAULT_FEATURE_FLAGS: FeatureFlags = { diff --git a/config/i18n.ts b/config/i18n.ts index 4cab6aa4..3c829530 100644 --- a/config/i18n.ts +++ b/config/i18n.ts @@ -2,14 +2,21 @@ import type { NuxtI18nOptions } from '@nuxtjs/i18n' import type { DateTimeFormats, NumberFormats, PluralizationRule, PluralizationRules } from '@intlify/core-base' import type { LocaleObject } from '#i18n' +import { satisfies } from '~~/mocks/semver' -interface LocaleObjectData extends LocaleObject { - numberFormats?: NumberFormats - dateTimeFormats?: DateTimeFormats - pluralRule?: PluralizationRule +interface InclusiveLocaleKey { + adoptInclusiveWriting?: boolean + inclusiveTransform?: (term: string) => string +} +declare module '#i18n' { + interface LocaleObject extends InclusiveLocaleKey { + numberFormats?: NumberFormats + dateTimeFormats?: DateTimeFormats + pluralRule?: PluralizationRule + } } -const locales: LocaleObjectData[] = [ +const locales: LocaleObject[] = [ { code: 'en-US', file: 'en-US.json', @@ -29,7 +36,7 @@ const locales: LocaleObjectData[] = [ const name = new Intl.PluralRules('ar-EG').select(choice) return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name] }, - } satisfies LocaleObjectData), + } satisfies LocaleObject), { code: 'de-DE', file: 'de-DE.json', @@ -64,6 +71,10 @@ const locales: LocaleObjectData[] = [ code: 'fr-FR', file: 'fr-FR.json', name: 'Français', + adoptInclusiveWriting: true, + inclusiveTransform(term: string) { + return term.replace(/·\w+·?/, '') + }, }, { code: 'uk-UA', @@ -87,6 +98,16 @@ const locales: LocaleObjectData[] = [ file: 'tr-TR.json', name: 'Türkçe', }, + ({ + code: 'ar-EG', + file: 'ar-EG.json', + name: 'العربية', + dir: 'rtl', + pluralRule: (choice: number) => { + const name = new Intl.PluralRules('ar-EG').select(choice) + return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name] + }, + } satisfies LocaleObject), ].sort((a, b) => a.code.localeCompare(b.code)) const datetimeFormats = Object.values(locales).reduce((acc, data) => { diff --git a/locales/en-US.json b/locales/en-US.json index 2727bc87..b9bc2253 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -273,6 +273,7 @@ }, "language": { "display_language": "Display Language", + "inclusive": "Use epicene terms (median point)", "label": "Language" }, "notifications": { diff --git a/locales/fr-FR.json b/locales/fr-FR.json index f59a106d..d715b4ca 100644 --- a/locales/fr-FR.json +++ b/locales/fr-FR.json @@ -268,6 +268,7 @@ }, "language": { "display_language": "Langue d'affichage", + "inclusive": "Utiliser l'écriture épicène (point médiant)", "label": "Langue" }, "notifications": { diff --git a/pages/settings/language/index.vue b/pages/settings/language/index.vue index 52112f3e..92ca5c05 100644 --- a/pages/settings/language/index.vue +++ b/pages/settings/language/index.vue @@ -1,5 +1,5 @@