Skip to content

Commit

Permalink
fix: 修改截图页国际化 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
027xiguapi committed May 14, 2024
1 parent 8ee8bf1 commit 72d144e
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 13 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@

The cross-Platform of `pear-rec` is based on `electronjs`, and the front-end is based on `reactjs`. The functions of screenshot, screen recording, recording, recording (dynamic image) gif are a project based on `webrtc` and `webcodecs`.

## 🖖 Vue

Screenshot implemented by community personnel based on `vue` 👉 [electron-screenshort](https://github.com/yejimeiming/electron-screenshort).

## 🌰 Example

[web pages](https://pear-rec-xiguapi.vercel.app/)
Expand Down Expand Up @@ -154,6 +150,11 @@ Features that have been ticked are the latest in the development process but may
| --- | --- | --- | --- |
| Link | [Download](https://github.com/027xiguapi/pear-rec/releases) | [Download](https://github.com/027xiguapi/pear-rec/releases) | [Download](https://github.com/027xiguapi/pear-rec/releases) |


## 🖖 Vue

Screenshot implemented by community personnel based on `vue` 👉 [electron-screenshort](https://github.com/yejimeiming/electron-screenshort).

## 👨‍👨‍👦‍👦 Feedback

We recommend that [issue](https://github.com/027xiguapi/pear-rec/issues) be used for problem feedback.
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/upload/UploadImg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function UploadImg(props) {
return (
<Space className={className} style={style}>
<Button type="primary" onClick={handleUpload}>
{children || '图片'}
{children || 'image'}
</Button>
<input
type="file"
Expand Down
4 changes: 4 additions & 0 deletions packages/web/src/i18n/locales/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,9 @@
"progress": "Update progress",
"version": "The last version is",
"error": "Error downloading the latest version."
},
"shotScreen": {
"image": "image",
"screen": "screen"
}
}
4 changes: 4 additions & 0 deletions packages/web/src/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,9 @@
"progress": "Update progress",
"version": "The last version is",
"error": "Error downloading the latest version."
},
"shotScreen": {
"image": "image",
"screen": "screen"
}
}
4 changes: 4 additions & 0 deletions packages/web/src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,9 @@
"progress": "进度",
"version": "最新版本",
"error": "下载最新版本时出错。"
},
"shotScreen": {
"image": "图片",
"screen": "屏幕"
}
}
40 changes: 32 additions & 8 deletions packages/web/src/pages/shotScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import { Button, Modal, Space, message } from 'antd';
import { saveAs } from 'file-saver';
import { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import UploadImg from '../../components/upload/UploadImg';
import { db, defaultUser } from '../../db';
import ininitApp from '../../pages/main';
import { searchImg } from '../../util/searchImg';
import { isURL } from '../../util/validate';
import { blobToBase64 } from '../../util/file';
import UploadImg from '@/components/upload/UploadImg';
import { db, defaultUser } from '@/db';
import ininitApp from '@/pages/main';
import { searchImg } from '@/util/searchImg';
import { isURL } from '@/util/validate';
import { blobToBase64 } from '@/util/file.ts';
import { Local } from '@/util/storage';
import styles from './index.module.scss';

let i18n = '';
function ShotScreen() {
const { t } = useTranslation();
const [user, setUser] = useState<any>({});
Expand Down Expand Up @@ -65,6 +67,7 @@ function ShotScreen() {
setScreenShotImg('');
});
}
i18n = Local.get('i18n');
}

async function getShotScreenImg() {
Expand Down Expand Up @@ -251,6 +254,27 @@ function ShotScreen() {
url={screenShotImg}
width={window.innerWidth}
height={window.innerHeight}
lang={
i18n != 'zh'
? {
operation_undo_title: 'Undo',
operation_mosaic_title: 'Mosaic',
operation_text_title: 'Text',
operation_brush_title: 'Brush',
operation_arrow_title: 'Arrow',
operation_ellipse_title: 'Ellipse',
operation_rectangle_title: 'Rectangle',
magnifier_position_label: 'Position',
operation_ok_title: 'Ok',
operation_cancel_title: 'Cancel',
operation_save_title: 'Save',
operation_redo_title: 'Redo',
operation_search_title: 'Search',
operation_scan_title: 'Scan',
operation_pin_title: 'Pin',
}
: {}
}
onSave={onSave}
onCancel={onCancel}
onOk={onOk}
Expand All @@ -262,9 +286,9 @@ function ShotScreen() {
<></>
) : (
<Space wrap className="btns">
<UploadImg handleUploadImg={handleUploadImg} />
<UploadImg handleUploadImg={handleUploadImg}>{t('shotScreen.image')}</UploadImg>
<Button type="primary" onClick={getShotScreenImg}>
屏幕
{t('shotScreen.screen')}
</Button>
</Space>
)}
Expand Down

0 comments on commit 72d144e

Please sign in to comment.