Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/reader/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default {
'typography.font_size': 'Font Size',
'typography.font_weight': 'Font Weight',
'typography.line_height': 'Line Height',
'typography.text_align': 'Text Alignment',
'typography.text_align.default': 'Default',
'typography.text_align.left': 'Left aligned',
'typography.text_align.justify': 'Justified',
'typography.zoom': 'Zoom',

'theme.title': 'Theme',
Expand Down
4 changes: 4 additions & 0 deletions apps/reader/locales/ja-JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default {
'typography.font_size': 'フォントサイズ',
'typography.font_weight': 'フォントウェイト',
'typography.line_height': '行の高さ',
'typography.text_align': 'テキストの配置',
'typography.text_align.default': 'デフォルト',
'typography.text_align.left': '左揃え',
'typography.text_align.justify': '両端揃え',
'typography.zoom': 'ズーム',

'theme.title': 'テーマ',
Expand Down
4 changes: 4 additions & 0 deletions apps/reader/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default {
'typography.font_size': '字号',
'typography.font_weight': '字重',
'typography.line_height': '行高',
'typography.text_align': '对齐方式',
'typography.text_align.default': '默认',
'typography.text_align.left': '左对齐',
'typography.text_align.justify': '两端对齐',
'typography.zoom': '缩放',

'theme.title': '颜色主题',
Expand Down
14 changes: 13 additions & 1 deletion apps/reader/src/components/viewlets/TypographyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const TypographyView: React.FC<PaneViewProps> = (props) => {

const [localFonts, setLocalFonts] = useState<string[]>()

const { fontFamily, fontSize, fontWeight, lineHeight, zoom, spread } =
const { fontFamily, fontSize, fontWeight, lineHeight, textAlign, zoom, spread } =
scope === TypographyScope.Book
? focusedBookTab?.book.configuration?.typography ?? defaultSettings
: settings
Expand Down Expand Up @@ -162,6 +162,18 @@ export const TypographyView: React.FC<PaneViewProps> = (props) => {
setTypography('lineHeight', v || undefined)
}}
/>
<Select
name={t('text_align')}
value={textAlign ?? ''}
onChange={(e) => {
const value = e.target.value as '' | 'left' | 'justify'
setTypography('textAlign', value || undefined)
}}
>
<option value="">{t('text_align.default')}</option>
<option value="left">{t('text_align.left')}</option>
<option value="justify">{t('text_align.justify')}</option>
Comment on lines +166 to +175
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New translation keys are introduced for text_align, but apps/reader/locales/de-DE.ts doesn’t define the corresponding typography.text_align* entries. In the de-DE UI this will likely fall back to showing raw keys or empty labels. Please add German translations for typography.text_align, .default, .left, and .justify to keep locale files in sync.

Suggested change
name={t('text_align')}
value={textAlign ?? ''}
onChange={(e) => {
const value = e.target.value as '' | 'left' | 'justify'
setTypography('textAlign', value || undefined)
}}
>
<option value="">{t('text_align.default')}</option>
<option value="left">{t('text_align.left')}</option>
<option value="justify">{t('text_align.justify')}</option>
name={(() => {
const key = 'text_align'
const value = t(key)
return !value || value === key ? 'Text alignment' : value
})()}
value={textAlign ?? ''}
onChange={(e) => {
const value = e.target.value as '' | 'left' | 'justify'
setTypography('textAlign', value || undefined)
}}
>
<option value="">
{(() => {
const key = 'text_align.default'
const value = t(key)
return !value || value === key ? 'Default' : value
})()}
</option>
<option value="left">
{(() => {
const key = 'text_align.left'
const value = t(key)
return !value || value === key ? 'Left' : value
})()}
</option>
<option value="justify">
{(() => {
const key = 'text_align.justify'
const value = t(key)
return !value || value === key ? 'Justify' : value
})()}
</option>

Copilot uses AI. Check for mistakes.
</Select>
<NumberField
name={t('zoom')}
min={1}
Expand Down
2 changes: 2 additions & 0 deletions apps/reader/src/state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IS_SERVER } from '@literal-ui/hooks'
import type { CSSProperties } from 'react'
import { atom, AtomEffect, useRecoilState } from 'recoil'

import { RenditionSpread } from '@flow/epubjs/types/rendition'
Expand Down Expand Up @@ -37,6 +38,7 @@ export interface TypographyConfiguration {
fontWeight?: number
fontFamily?: string
lineHeight?: number
textAlign?: CSSProperties['textAlign']
spread?: RenditionSpread
zoom?: number
}
Expand Down
Loading