Skip to content

Commit

Permalink
remove stuff from translations
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Sep 16, 2022
1 parent fd0beb5 commit df14075
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 52 deletions.
8 changes: 7 additions & 1 deletion src/client/theme-default/components/VPDocAsideOutline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ function handleClick({ target: el }: Event) {
<div class="outline-marker" ref="marker" />

<div class="outline-title">
{{ theme.translations?.outlineTitle || 'On this page' }}
{{
(typeof theme.outline === 'object' &&
!Array.isArray(theme.outline) &&
theme.outline.label) ||
theme.outlineTitle ||
'On this page'
}}
</div>

<nav aria-labelledby="doc-outline-aria-label">
Expand Down
4 changes: 2 additions & 2 deletions src/client/theme-default/components/VPDocFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ const showFooter = computed(() => {
<div v-if="control.prev || control.next" class="prev-next">
<div class="pager">
<a v-if="control.prev" class="pager-link prev" :href="normalizeLink(control.prev.link)">
<span class="desc">{{ theme.translations?.docFooter?.prev || 'Previous page' }}</span>
<span class="desc">{{ theme.docFooter?.prev || 'Previous page' }}</span>
<span class="title">{{ control.prev.text }} </span>
</a>
</div>
<div class="pager" :class="{ 'has-prev': control.prev }">
<a v-if="control.next" class="pager-link next" :href="normalizeLink(control.next.link)">
<span class="desc">{{ theme.translations?.docFooter?.next || 'Next page' }}</span>
<span class="desc">{{ theme.docFooter?.next || 'Next page' }}</span>
<span class="title">{{ control.next.text }}</span>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ onMounted(() => {

<template>
<p class="VPLastUpdated">
{{ theme.translations?.lastUpdatedText || 'Last updated' }}:
{{ theme.lastUpdatedText || 'Last updated' }}:
<time :datatime="isoDatetime">{{ datetime }}</time>
</p>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/client/theme-default/components/VPLocalNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ function scrollToTop() {
>
<VPIconAlignLeft class="menu-icon" />
<span class="menu-text">
{{ theme.translations?.sidebarMenuLabel || 'Menu' }}
{{ theme.sidebarMenuLabel || 'Menu' }}
</span>
</button>

<a class="top-link" href="#" @click="scrollToTop">
{{ theme.translations?.returnToTopLabel || 'Return to top' }}
{{ theme.returnToTopLabel || 'Return to top' }}
</a>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPNavBarExtra.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const hasExtraContent = computed(
<div v-if="site.appearance" class="group">
<div class="item appearance">
<p class="label">
{{ theme.translations?.darkModeSwitchLabel || 'Appearance' }}
{{ theme.darkModeSwitchLabel || 'Appearance' }}
</p>
<div class="appearance-action">
<VPSwitchAppearance />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { site, theme } = useData()
<template>
<div v-if="site.appearance" class="VPNavScreenAppearance">
<p class="text">
{{ theme.translations?.darkModeSwitchLabel || 'Appearance' }}
{{ theme.darkModeSwitchLabel || 'Appearance' }}
</p>
<VPSwitchAppearance />
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/client/theme-default/composables/outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ export function getHeaders(pageOutline: DefaultTheme.Config['outline']) {

export function resolveHeaders(
headers: MenuItem[],
levelsRange: Exclude<DefaultTheme.Config['outline'], false> = 2
range?: Exclude<DefaultTheme.Config['outline'], false>
) {
const levelsRange =
(typeof range === 'object' && !Array.isArray(range)
? range.level
: range) || 2

const levels: [number, number] =
typeof levelsRange === 'number'
? [levelsRange, levelsRange]
Expand Down
104 changes: 61 additions & 43 deletions types/default-theme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ export namespace DefaultTheme {
*
* @default 2
*/
outline?: number | [number, number] | 'deep' | false
outline?: Outline | Outline['level'] | false

/**
* @deprecated
* Use `outline.label` instead.
*
* @default 'On this page'
*/
outlineTitle?: string

/**
* The nav items.
Expand All @@ -36,6 +44,18 @@ export namespace DefaultTheme {
*/
editLink?: EditLink

/**
* Set custom last updated text.
*
* @default 'Last updated'
*/
lastUpdatedText?: string

/**
* Set custom prev/next labels.
*/
docFooter?: DocFooter

/**
* The social links to be displayed at the end of the nav bar. Perfect for
* placing links to social services such as GitHub, Twitter, Facebook, etc.
Expand All @@ -47,6 +67,21 @@ export namespace DefaultTheme {
*/
footer?: Footer

/**
* @default 'Appearance'
*/
darkModeSwitchLabel?: string

/**
* @default 'Menu'
*/
sidebarMenuLabel?: string

/**
* @default 'Return to top'
*/
returnToTopLabel?: string

/**
* The algolia options. Leave it undefined to disable the search feature.
*/
Expand All @@ -56,48 +91,6 @@ export namespace DefaultTheme {
* The carbon ads options. Leave it undefined to disable the ads feature.
*/
carbonAds?: CarbonAdsOptions

/**
* Custom labels
*/
translations?: {
/**
* @default 'On this page'
*/
outlineTitle?: string

/**
* @default 'Last updated'
*/
lastUpdatedText?: string

docFooter?: {
/**
* @default 'Previous page'
*/
prev?: string

/**
* @default 'Next page'
*/
next?: string
}

/**
* @default 'Appearance'
*/
darkModeSwitchLabel?: string

/**
* @default 'Menu'
*/
sidebarMenuLabel?: string

/**
* @default 'Return to top'
*/
returnToTopLabel?: string
}
}

// nav -----------------------------------------------------------------------
Expand Down Expand Up @@ -185,6 +178,24 @@ export namespace DefaultTheme {
text?: string
}

// prev-next -----------------------------------------------------------------

export interface DocFooter {
/**
* Custom label for previous page button.
*
* @default 'Previous page'
*/
prev?: string

/**
* Custom label for next page button.
*
* @default 'Next page'
*/
next?: string
}

// social link ---------------------------------------------------------------

export interface SocialLink {
Expand Down Expand Up @@ -223,6 +234,13 @@ export namespace DefaultTheme {
sponsor?: string
}

// outline -------------------------------------------------------------------

export interface Outline {
level?: number | [number, number] | 'deep'
label?: string
}

// algolia ------------------------------------------------------------------

/**
Expand Down

0 comments on commit df14075

Please sign in to comment.