@samitouri / QOSami-HFS / commits / 54341306

fix: file-show help couldn't be translated

Massimo Melina committed Aug 4, 2023 at 11:02 UTC 5434130682497f7a1ba1afc65afe54f76f0d4b87
3 files changed +39 -14
frontend/src/show.ts
+15 -12
@@ -3,10 +3,11 @@ import { createElement as h, Fragment, useEffect, useRef, useState } from 'react
3 import { hfsEvent, hIcon, newDialog, restartAnimation } from './misc'
4 import { useEventListener, useWindowSize } from 'usehooks-ts'
5 import { EntryDetails, useMidnight } from './BrowseFiles'
6 -import { Flex, FlexV, Html, iconBtn, Spinner } from './components'
6 +import { Flex, FlexV, iconBtn, Spinner } from './components'
7 import { openFileMenu } from './fileMenu'
8 -import { useI18N } from './i18n'
8 +import { t, useI18N } from './i18n'
9 import { alertDialog } from './dialog'
10 +import _ from 'lodash'
11
12 enum ZoomMode {
13 fullWidth,
@@ -168,16 +169,18 @@ function Video({ onLoad, ...rest }: any) {
169
170 function showHelp() {
171 newDialog({
171 - title: "File show help",
172 + title: t`File Show help`,
173 className: 'file-show-help',
173 - Content: () => h(Html, { code: `
174 - You can use the keyboard for some actions:
175 - <br/><kbd>left/right</kbd> go to previous/next file
176 - <br/><kbd>up/down</kbd> scroll tall images
177 - <br/><kbd>space</kbd> select
178 - <br/><kbd>D</kbd> download
179 - <br/><kbd>Z</kbd> zoom modes
180 - <br/><kbd>F</kbd> full screen
181 - ` })
174 + Content: () => h(Fragment, {},
175 + t('showHelpMain', {}, "You can use the keyboard for some actions:"),
176 + _.map({
177 + "←/→": "go to previous/next file",
178 + "↑/↓": "scroll tall images",
179 + "space": "select",
180 + "D": "download",
181 + "Z": "zoom modes",
182 + "F": "full screen",
183 + }, (v,k) => h('div', { key: k }, h('kbd', {}, t('showHelp_' + k, {}, k)), ' ', t('showHelp_' + k + '_body', {}, v)) )
184 + )
185 })
186 }
src/langs/hfs-lang-en.json
+13 -1
@@ -122,6 +122,18 @@
122 "Uploader": "Uploader",
123 "Download counter": "Download counter",
124 "Switch zoom mode": "Switch zoom mode",
125 - "Full screen": "Full screen"
125 + "Full screen": "Full screen",
126 +
127 + "File Show help": "File Show help",
128 + "showHelpMain": "You can use the keyboard for some actions:",
129 + "showHelp_←/→": "←/→",
130 + "showHelp_↑/↓": "↑/↓",
131 + "showHelp_space": "space",
132 + "showHelp_←/→_body": "go to previous/next file",
133 + "showHelp_↑/↓_body": "scroll tall images",
134 + "showHelp_space_body": "select",
135 + "showHelp_D_body": "download",
136 + "showHelp_Z_body": "zoom modes",
137 + "showHelp_F_body": "full screen"
138 }
139 }
src/langs/hfs-lang-it.json
+11 -1
@@ -116,6 +116,16 @@
116 "Uploader": "Upload da",
117 "Download counter": "Download conteggiati",
118 "Switch zoom mode": "Cambia zoom",
119 - "Full screen": "Pieno schermo"
119 + "Full screen": "Pieno schermo",
120 +
121 + "File Show help": "Guida File Show",
122 + "showHelpMain": "Puoi usare la tastiera per alcune azioni:",
123 + "showHelp_space": "spazio",
124 + "showHelp_←/→_body": "vai al precedente/prossimo file",
125 + "showHelp_↑/↓_body": "scorri immagini lunghe",
126 + "showHelp_space_body": "seleziona",
127 + "showHelp_D_body": "download",
128 + "showHelp_Z_body": "cambia modalità zoom",
129 + "showHelp_F_body": "pieno schermo"
130 }
131 }