Skip to content

Commit

Permalink
feat: add hover titles to some icons
Browse files Browse the repository at this point in the history
  • Loading branch information
YunFeng0817 committed May 13, 2021
1 parent 0d7d2ba commit c298ad3
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 44 deletions.
5 changes: 4 additions & 1 deletion config/webpack.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ module.exports = {
},
{
test: [/\.svg$/],
use: "@svgr/webpack",
loader: "@svgr/webpack",
options: {
titleProp: true,
},
},
],
},
Expand Down
6 changes: 5 additions & 1 deletion src/content/display/DrawerBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ export default function DrawerBlock(props) {
<Content ref={contentElRef}>{props.children}</Content>
{useDrawer && (
<Handle fold={fold} onClick={() => setFold(!fold)}>
{fold ? <StyledArrowDownIcon /> : <StyledArrowUpIcon />}
{fold ? (
<StyledArrowDownIcon title={chrome.i18n.getMessage("ClickToExpand")} />
) : (
<StyledArrowUpIcon title={chrome.i18n.getMessage("ClickToFold")} />
)}
</Handle>
)}
</Drawer>
Expand Down
8 changes: 4 additions & 4 deletions src/content/display/Panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ export default function ResultPanel() {
</SourceOption>
<HeadIcons>
<HeadIcon onClick={() => channel.emit("open_options_page")}>
<SettingIcon />
<SettingIcon title={chrome.i18n.getMessage("Settings")} />
</HeadIcon>
{panelFix ? (
<HeadIcon
Expand All @@ -608,7 +608,7 @@ export default function ResultPanel() {
});
}}
>
<PinIcon />
<PinIcon title={chrome.i18n.getMessage("UnfixResultFrame")} />
</HeadIcon>
) : (
<HeadIcon
Expand All @@ -619,11 +619,11 @@ export default function ResultPanel() {
});
}}
>
<UnpinIcon />
<UnpinIcon title={chrome.i18n.getMessage("FixResultFrame")} />
</HeadIcon>
)}
<HeadIcon onClick={() => setOpen(false)}>
<CloseIcon />
<CloseIcon title={chrome.i18n.getMessage("CloseResultFrame")} />
</HeadIcon>
</HeadIcons>
</Head>
Expand Down
3 changes: 3 additions & 0 deletions src/content/display/Result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default function Result(props) {
element: translateResultElRef.current,
})
}
title={chrome.i18n.getMessage("CopyResult")}
/>
</TextLine>
{(displayTPronunciationIcon || displayTPronunciation) && (
Expand Down Expand Up @@ -146,6 +147,7 @@ export default function Result(props) {
</div>
{editing ? (
<StyledEditDoneIcon
title={chrome.i18n.getMessage("Retranslate")}
onClick={() =>
setEditing({
edit: false,
Expand All @@ -155,6 +157,7 @@ export default function Result(props) {
/>
) : (
<StyledEditIcon
title={chrome.i18n.getMessage("EditText")}
onClick={() =>
setEditing({
edit: true,
Expand Down
40 changes: 20 additions & 20 deletions static/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"description": "選択したテキストを翻訳するためのショートカット"
},
"FixResultFrame": {
"message": "結果フレームを修正",
"description": "翻訳結果のフレームを修正する"
"message": "結果ボックスを修正しました",
"description": "結果ボックスを修正しました"
},
"UnfixResultFrame": {
"message": "Unfix the result frame",
"description": "Unfix the translating result frame."
"message": "翻訳結果表示ボックスの修正を解除します",
"description": "翻訳結果表示ボックスの修正を解除します。"
},
"CloseResultFrame": {
"message": "結果フレームを閉じる",
Expand Down Expand Up @@ -84,40 +84,40 @@
"description": "原文を読み上げる"
},
"SourcePronunciation": {
"message": "Source Pronunciation",
"description": "Source Pronunciation"
"message": "ソース発音",
"description": "ソース発音"
},
"TargetPronunciation": {
"message": "Target Pronunciation",
"description": "Target Pronunciation"
"message": "ターゲットの発音",
"description": "ターゲットの発音"
},
"SourcePronunciationIcon": {
"message": "Source Pronunciation Icon",
"description": "Source Pronunciation Icon"
"message": "ソース発音アイコン",
"description": "ソース発音アイコン。"
},
"TargetPronunciationIcon": {
"message": "Target Pronunciation Icon",
"description": "Target Pronunciation Icon"
"message": "ターゲット発音アイコン",
"description": "ターゲット発音アイコン。"
},
"PronounceTranslated": {
"message": "翻訳されたテキストを読み上げる",
"description": "翻訳されたテキストを読み上げる"
},
"ClickToExpand": {
"message": "Click to expand",
"description": "Click to expand."
"message": "クリックして展開",
"description": "クリックして展開。"
},
"ClickToFold": {
"message": "Click to fold",
"description": "Click to fold."
"message": "クリックして折りたたむ",
"description": "クリックして折りたたむ。"
},
"EditText": {
"message": "Edit text",
"description": "Edit selected text."
"message": "テキストを編集するt",
"description": "テキストを編集する。"
},
"Retranslate": {
"message": "Re-translate",
"description": "Re-translate the edited text."
"message": "再翻訳",
"description": "編集したテキストを再翻訳します。"
},
"CopyResult": {
"message": "結果をコピー",
Expand Down
36 changes: 18 additions & 18 deletions static/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"description": "Фиксация рамки результата перевода."
},
"UnfixResultFrame": {
"message": "Unfix the result frame",
"description": "Unfix the translating result frame."
"message": "Отключить окно отображения результатов перевода",
"description": "Отключить окно отображения результатов перевода."
},
"CloseResultFrame": {
"message": "Закрыть рамку результата",
Expand Down Expand Up @@ -72,20 +72,20 @@
"description": "Фонетический символ"
},
"SourcePronunciation": {
"message": "Source Pronunciation",
"description": "Source Pronunciation"
"message": "Источник Произношение",
"description": "Источник Произношение"
},
"TargetPronunciation": {
"message": "Target Pronunciation",
"description": "Target Pronunciation"
"message": "Целевое произношение",
"description": "Целевое произношение"
},
"SourcePronunciationIcon": {
"message": "Source Pronunciation Icon",
"description": "Source Pronunciation Icon"
"message": "Источник Произношение Иконка",
"description": "Источник Произношение Иконка."
},
"TargetPronunciationIcon": {
"message": "Target Pronunciation Icon",
"description": "Target Pronunciation Icon"
"message": "Значок целевого произношения",
"description": "Значок целевого произношения."
},
"Pronounce": {
"message": "произнести",
Expand All @@ -104,20 +104,20 @@
"description": "Читать переведённый текст."
},
"ClickToExpand": {
"message": "Click to expand",
"description": "Click to expand."
"message": "Нажмите, чтобы развернуть",
"description": "Нажмите, чтобы развернуть."
},
"ClickToFold": {
"message": "Click to fold",
"description": "Click to fold."
"message": "Нажмите, чтобы сложить",
"description": "Нажмите, чтобы сложить."
},
"EditText": {
"message": "Edit text",
"description": "Edit selected text."
"message": "Редактировать текст",
"description": "Редактировать выделенный текст."
},
"Retranslate": {
"message": "Re-translate",
"description": "Re-translate the edited text."
"message": "Перевести",
"description": "Перевести отредактированный текст заново."
},
"CopyResult": {
"message": "Скопировать результат",
Expand Down

0 comments on commit c298ad3

Please sign in to comment.