mirror of
https://github.com/elk-zone/elk.git
synced 2025-03-28 20:41:20 +03:00
feat: init inclusive as preference
This commit is contained in:
parent
9a8e645e16
commit
863eab1598
5 changed files with 41 additions and 7 deletions
|
@ -13,6 +13,7 @@ export interface WellnessSettings {
|
||||||
hideBoostCount: boolean
|
hideBoostCount: boolean
|
||||||
hideFavoriteCount: boolean
|
hideFavoriteCount: boolean
|
||||||
hideFollowerCount: boolean
|
hideFollowerCount: boolean
|
||||||
|
useInclusiveWriting: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserSettings {
|
export interface UserSettings {
|
||||||
|
@ -38,6 +39,7 @@ export const DEFAULT_WELLNESS_SETTINGS: WellnessSettings = {
|
||||||
hideBoostCount: false,
|
hideBoostCount: false,
|
||||||
hideFavoriteCount: false,
|
hideFavoriteCount: false,
|
||||||
hideFollowerCount: false,
|
hideFollowerCount: false,
|
||||||
|
useInclusiveWriting: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DEFAULT_FEATURE_FLAGS: FeatureFlags = {
|
export const DEFAULT_FEATURE_FLAGS: FeatureFlags = {
|
||||||
|
|
|
@ -2,14 +2,21 @@ import type { NuxtI18nOptions } from '@nuxtjs/i18n'
|
||||||
import type { DateTimeFormats, NumberFormats, PluralizationRule, PluralizationRules } from '@intlify/core-base'
|
import type { DateTimeFormats, NumberFormats, PluralizationRule, PluralizationRules } from '@intlify/core-base'
|
||||||
|
|
||||||
import type { LocaleObject } from '#i18n'
|
import type { LocaleObject } from '#i18n'
|
||||||
|
import { satisfies } from '~~/mocks/semver'
|
||||||
|
|
||||||
interface LocaleObjectData extends LocaleObject {
|
interface InclusiveLocaleKey {
|
||||||
numberFormats?: NumberFormats
|
adoptInclusiveWriting?: boolean
|
||||||
dateTimeFormats?: DateTimeFormats
|
inclusiveTransform?: (term: string) => string
|
||||||
pluralRule?: PluralizationRule
|
}
|
||||||
|
declare module '#i18n' {
|
||||||
|
interface LocaleObject extends InclusiveLocaleKey {
|
||||||
|
numberFormats?: NumberFormats
|
||||||
|
dateTimeFormats?: DateTimeFormats
|
||||||
|
pluralRule?: PluralizationRule
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const locales: LocaleObjectData[] = [
|
const locales: LocaleObject[] = [
|
||||||
{
|
{
|
||||||
code: 'en-US',
|
code: 'en-US',
|
||||||
file: 'en-US.json',
|
file: 'en-US.json',
|
||||||
|
@ -29,7 +36,7 @@ const locales: LocaleObjectData[] = [
|
||||||
const name = new Intl.PluralRules('ar-EG').select(choice)
|
const name = new Intl.PluralRules('ar-EG').select(choice)
|
||||||
return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name]
|
return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name]
|
||||||
},
|
},
|
||||||
} satisfies LocaleObjectData),
|
} satisfies LocaleObject),
|
||||||
{
|
{
|
||||||
code: 'de-DE',
|
code: 'de-DE',
|
||||||
file: 'de-DE.json',
|
file: 'de-DE.json',
|
||||||
|
@ -64,6 +71,10 @@ const locales: LocaleObjectData[] = [
|
||||||
code: 'fr-FR',
|
code: 'fr-FR',
|
||||||
file: 'fr-FR.json',
|
file: 'fr-FR.json',
|
||||||
name: 'Français',
|
name: 'Français',
|
||||||
|
adoptInclusiveWriting: true,
|
||||||
|
inclusiveTransform(term: string) {
|
||||||
|
return term.replace(/·\w+·?/, '')
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'uk-UA',
|
code: 'uk-UA',
|
||||||
|
@ -87,6 +98,16 @@ const locales: LocaleObjectData[] = [
|
||||||
file: 'tr-TR.json',
|
file: 'tr-TR.json',
|
||||||
name: 'Türkçe',
|
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))
|
].sort((a, b) => a.code.localeCompare(b.code))
|
||||||
|
|
||||||
const datetimeFormats = Object.values(locales).reduce((acc, data) => {
|
const datetimeFormats = Object.values(locales).reduce((acc, data) => {
|
||||||
|
|
|
@ -273,6 +273,7 @@
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"display_language": "Display Language",
|
"display_language": "Display Language",
|
||||||
|
"inclusive": "Use epicene terms (median point)",
|
||||||
"label": "Language"
|
"label": "Language"
|
||||||
},
|
},
|
||||||
"notifications": {
|
"notifications": {
|
||||||
|
|
|
@ -268,6 +268,7 @@
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"display_language": "Langue d'affichage",
|
"display_language": "Langue d'affichage",
|
||||||
|
"inclusive": "Utiliser l'écriture épicène (point médiant)",
|
||||||
"label": "Langue"
|
"label": "Langue"
|
||||||
},
|
},
|
||||||
"notifications": {
|
"notifications": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { t } = useI18n()
|
const { t, localeProperties } = useI18n()
|
||||||
|
|
||||||
useHeadFixed({
|
useHeadFixed({
|
||||||
title: () => `${t('settings.language.label')} | ${t('nav.settings')}`,
|
title: () => `${t('settings.language.label')} | ${t('nav.settings')}`,
|
||||||
|
@ -18,6 +18,15 @@ useHeadFixed({
|
||||||
<p font-medium>{{ $t('settings.language.display_language') }}</p>
|
<p font-medium>{{ $t('settings.language.display_language') }}</p>
|
||||||
<SettingsLanguage select-settings />
|
<SettingsLanguage select-settings />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<SettingsToggleItem
|
||||||
|
v-if="localeProperties.adoptInclusiveWriting"
|
||||||
|
:checked="getWellnessSetting('useInclusiveWriting')"
|
||||||
|
m-t
|
||||||
|
@click="toggleWellnessSetting('useInclusiveWriting')"
|
||||||
|
>
|
||||||
|
{{ $t('settings.language.inclusive') }}
|
||||||
|
</SettingsToggleItem>
|
||||||
</div>
|
</div>
|
||||||
</MainContent>
|
</MainContent>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Add table
Reference in a new issue