Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n translation for tooltips #1322

Closed
wants to merge 3 commits into from
Closed
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: 3 additions & 1 deletion src/common/backend/services/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ export interface ServiceMeta {
permission?: chrome.permissions.Permissions;
}

export interface UpdateTOCRequest {}

export interface DocumentService<T = any> {
getId(): string;

getRepositories(): Promise<Repository[]>;

createDocument(request: CreateDocumentRequest): Promise<CompleteStatus | void>;
createDocument(request: T): Promise<CompleteStatus | void>;

getUserInfo(): Promise<UserInfo>;

Expand Down
7 changes: 6 additions & 1 deletion src/common/backend/services/yuque/interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompleteStatus, CreateDocumentRequest } from './../interface';
import { CompleteStatus, CreateDocumentRequest, UpdateTOCRequest } from './../interface';
import { Repository } from '../interface';

export enum RepositoryType {
Expand Down Expand Up @@ -53,3 +53,8 @@ export interface YuqueCompleteStatus extends CompleteStatus {
export interface YuqueCreateDocumentRequest extends CreateDocumentRequest {
slug?: string;
}

export interface YuqueUpdateTOCRequest extends UpdateTOCRequest{
repositoryId: string;
documentId: number[];
}
24 changes: 24 additions & 0 deletions src/common/backend/services/yuque/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
YuqueRepository,
YuqueCompleteStatus,
YuqueCreateDocumentRequest,
YuqueUpdateTOCRequest,
} from './interface';

const HOST = 'https://www.yuque.com';
Expand Down Expand Up @@ -100,6 +101,9 @@ export default class YuqueDocumentService implements DocumentService {
}
);
const data = response;

await this.updateYuqueTOC({ repositoryId, documentId: [data.id] });

return {
href: `${HOST}/${repository.namespace}/${data.slug}`,
repositoryId,
Expand Down Expand Up @@ -150,4 +154,24 @@ export default class YuqueDocumentService implements DocumentService {
return [];
}
};

private updateYuqueTOC = async (info: YuqueUpdateTOCRequest) => {
const { repositoryId, documentId } = info;
const requestBody = {
action: 'prependNode',
action_mode: 'child',
doc_ids: documentId,
type: 'DOC',
};

try {
const response = await this.request.put(`repos/${repositoryId}/toc`, {
data: requestBody,
});
return response;
} catch (_error) {
return {};
}

};
}
9 changes: 7 additions & 2 deletions src/extensions/extensions/bookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ export default new TextExtension(
description: 'Add bookmark.',
icon: 'link',
i18nManifest: {
'zh-CN': { name: '书签', description: '添加书签' },
'de-DE': { name: 'Lesezeichen', description: 'Lesezeichen hinzufügen.' },
'en-US': { name: 'Bookmark', description: 'Add bookmark.' },
'ja-JP': { name: 'ブックマーク', description: 'ブックマークを追加します。' },
'ko-KR': { name: '북마크', description: '북마크 추가.' },
'ru-RU': { name: 'Закладка', description: 'Добавить закладку.' },
'zh-CN': { name: '书签', description: '添加书签' },
},
},
{
run: async context => {
run: async (context) => {
const { document, locale } = context;
switch (locale) {
case 'zh-CN': {
Expand Down
6 changes: 6 additions & 0 deletions src/extensions/extensions/extensions/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ export default new ToolExtension(
version: '0.0.1',
description: 'Delete selected page elements.',
i18nManifest: {
'de-DE': { name: 'Element löschen', description: 'Ausgewählte Seitenelemente löschen.' },
'en-US': { name: 'Delete Element', description: 'Delete selected page elements.' },
'ja-JP': { name: '要素を削除', description: '選択したページ要素を削除します。' },
'ko-KR': { name: '요소 삭제', description: '선택한 페이지 요소를 삭제합니다.' },
'ru-RU': { name: 'Удалить элемент', description: 'Удалить выбранные элементы страницы.' },
'zh-CN': { name: '删除元素', description: '删除选择的页面元素。' },
'zh-TW': { name: '刪除元素', description: '刪除選擇的頁面元素。' },
},
},
{
Expand Down
7 changes: 6 additions & 1 deletion src/extensions/extensions/extensions/selectTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ export default new ToolExtension(
version: '0.0.1',
description: 'Manual selection page element.',
i18nManifest: {
'zh-CN': { name: '手动选取' },
'de-DE': { name: 'Manuelle Auswahl', description: 'Manuelle Auswahl von Seitenelementen.' },
'en-US': { name: 'Manual selection', description: 'Manual selection of page elements.' },
'ja-JP': { name: '手動選択', description: 'ページ要素を手動で選択します。' },
'ko-KR': { name: '수동 선택', description: '페이지 요소를 수동으로 선택합니다.' },
'ru-RU': { name: 'Ручной выбор', description: 'Ручной выбор элементов страницы.' },
'zh-CN': { name: '手动选取', description: '手动选取页面中的元素' },
},
},
{
Expand Down
5 changes: 5 additions & 0 deletions src/extensions/extensions/extensions/uploadImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export default new ToolExtension(
automatic: true,
description: 'Upload images to image host.',
i18nManifest: {
'de-DE': { name: 'Bild hochladen', description: 'Bilder auf den Bildhost hochladen.' },
'en-US': { name: 'Upload Image', description: 'Upload images to image host.' },
'ja-JP': { name: '画像をアップロード', description: '画像を画像ホストにアップロードします。' },
'ko-KR': { name: '이미지 업로드', description: '이미지를 이미지 호스트에 업로드합니다.' },
'ru-RU': { name: 'Загрузить изображение', description: 'Загрузить изображения на хост изображений.' },
'zh-CN': { name: '上传图片', description: '把文章内图片上传到图床' },
},
},
Expand Down
13 changes: 9 additions & 4 deletions src/extensions/extensions/fullPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ export default new TextExtension(
version: '0.0.1',
description: 'Save Full Page and turn ro Markdown.',
icon: 'copy',
i18nManifest: {
'zh-CN': { name: '整个页面', description: '把整个页面元素转换为 Markdown' },
},
},
i18nManifest: {
'de-DE': { name: 'Vollständige Seite', description: 'Speichern Sie die gesamte Seite und konvertieren Sie sie in Markdown.' },
'en-US': { name: 'Full Page', description: 'Save Full Page and turn to Markdown.' },
'ja-JP': { name: '全ページ', description: '全ページを保存し、Markdownに変換します。' },
'ko-KR': { name: '전체 페이지', description: '전체 페이지를 저장하고 Markdown으로 변환합니다.' },
'ru-RU': { name: 'Полная страница', description: 'Сохранить полную страницу и преобразовать в Markdown.' },
'zh-CN': { name: '整个页面', description: '把整个页面元素转换为 Markdown' },
}
},
{
run: async context => {
const { turndown, $ } = context;
Expand Down
13 changes: 9 additions & 4 deletions src/extensions/extensions/qrcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ export default new TextExtension<string>(
icon: 'qrcode',
version: '0.0.1',
description: 'Convert the URL of the current page to a QR code.',
i18nManifest: {
'zh-CN': { name: '二维码', description: '显示当前链接为二维码' },
},
},
i18nManifest: {
'de-DE': { name: 'QR-Code', description: 'Konvertieren Sie die URL der aktuellen Seite in einen QR-Code.' },
'en-US': { name: 'QR code', description: 'Convert the URL of the current page to a QR code.' },
'ja-JP': { name: 'QRコード', description: '現在のページのURLをQRコードに変換します。' },
'ko-KR': { name: 'QR 코드', description: '현재 페이지의 URL을 QR 코드로 변환합니다.' },
'ru-RU': { name: 'QR код', description: 'Преобразовать URL текущей страницы в QR-код.' },
'zh-CN': { name: '二维码', description: '显示当前链接为二维码' },
}
},
{
init: ({ currentImageHostingService }) => !!currentImageHostingService,
run: async context => {
Expand Down
13 changes: 9 additions & 4 deletions src/extensions/extensions/readability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ export default new TextExtension(
icon: 'copy',
version: '0.0.1',
description: 'Intelligent extraction of webpage main content.',
i18nManifest: {
'zh-CN': { name: '智能提取', description: '智能提取当前页面元素' },
},
},
i18nManifest: {
'de-DE': { name: 'Lesbarkeit', description: 'Intelligente Extraktion des Hauptinhalts der Webseite.' },
'en-US': { name: 'Readability', description: 'Intelligent extraction of webpage main content.' },
'ja-JP': { name: '読みやすさ', description: 'ウェブページの主要な内容をインテリジェントに抽出します。' },
'ko-KR': { name: '가독성', description: '웹 페이지의 주요 내용을 지능적으로 추출합니다.' },
'ru-RU': { name: 'Читаемость', description: 'Интеллектуальная извлечение основного содержимого веб-страницы.' },
'zh-CN': { name: '智能提取', description: '智能提取当前页面元素' },
}
},
{
run: async context => {
const { turndown, document, Readability, $ } = context;
Expand Down
13 changes: 9 additions & 4 deletions src/extensions/extensions/screenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ export default new TextExtension<SelectAreaPosition>(
name: 'Screenshots',
icon: 'picture',
version: '0.0.1',
i18nManifest: {
'zh-CN': { name: '截图' },
},
},
i18nManifest: {
'de-DE': { name: 'Screenshots', description: 'Speichern Sie den aktuellen Inhalt als Bild.' },
'en-US': { name: 'Screenshots', description: 'Save current clipping content as an image.' },
'ja-JP': { name: 'スクリーンショット', description: '現在のクリップ内容を画像として保存します。' },
'ko-KR': { name: '스크린샷', description: '현재 클립 내용을 이미지로 저장합니다.' },
'ru-RU': { name: 'Скриншоты', description: 'Сохранить текущее содержимое как изображение.' },
'zh-CN': { name: '截图', description: '将当前剪藏内容保存为图片' }, // 保留简体中文
}
},
{
init: ({ currentImageHostingService }) => !!currentImageHostingService,
run: async context => {
Expand Down
13 changes: 9 additions & 4 deletions src/extensions/extensions/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ export default new TextExtension(
icon: 'select',
version: '0.0.1',
description: 'Manual selection page element.',
i18nManifest: {
'zh-CN': { name: '手动选取' },
},
},
i18nManifest: {
'de-DE': { name: 'Manuelle Auswahl', description: 'Manuelle Auswahl von Seitenelementen.' },
'en-US': { name: 'Manual selection', description: 'Manual selection of page elements.' },
'ja-JP': { name: '手動選択', description: 'ページ要素を手動で選択します。' },
'ko-KR': { name: '수동 선택', description: '페이지 요소를 수동으로 선택합니다.' },
'ru-RU': { name: 'Ручной выбор', description: 'Ручной выбор элементов страницы.' },
'zh-CN': { name: '手动选取', description: '手动选取页面元素' },
}
},
{
run: async context => {
const { turndown, Highlighter, toggleClipper, $ } = context;
Expand Down
16 changes: 9 additions & 7 deletions src/extensions/extensions/web-clipper/clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ export default new ToolExtension(
version: '0.0.1',
description: 'Clear Content',
apiVersion: '1.12.0',
i18nManifest: {
'zh-CN': {
name: '清空',
description: '清空内容',
},
},
},
i18nManifest: {
'de-DE': { name: 'Löschen', description: 'Inhalt löschen.' },
'en-US': { name: 'Clear', description: 'Clear Content' },
'ja-JP': { name: 'クリア', description: '内容をクリアします。' },
'ko-KR': { name: '지우기', description: '내용 지우기' },
'ru-RU': { name: 'Очистить', description: 'Очистить содержимое' },
'zh-CN': { name: '清空', description: '清空内容' },
}
},
{
init: ({ pathname }) => {
return pathname.startsWith('/plugin');
Expand Down
16 changes: 9 additions & 7 deletions src/extensions/extensions/web-clipper/copyToClipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ export default new ToolExtension(
icon: 'copy',
version: '0.0.1',
description: 'Copy To Clipboard',
i18nManifest: {
'zh-CN': {
name: '复制到剪切板',
description: 'Copy To Clipboard',
},
},
},
i18nManifest: {
'de-DE': { name: 'In die Zwischenablage kopieren', description: 'In die Zwischenablage kopieren.' },
'en-US': { name: 'Copy To Clipboard', description: 'Copy To Clipboard' },
'ja-JP': { name: 'クリップボードにコピー', description: 'クリップボードにコピーします。' },
'ko-KR': { name: '클립보드에 복사', description: '클립보드에 복사합니다.' },
'ru-RU': { name: 'Копировать в буфер обмена', description: 'Копировать в буфер обмена' },
'zh-CN': { name: '复制', description: '复制到剪贴板' },
}
},
{
afterRun: ({ copyToClipboard, data }) => {
copyToClipboard(data);
Expand Down
12 changes: 7 additions & 5 deletions src/extensions/extensions/web-clipper/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ export default new ToolExtension(
description: 'Save as Markdown and Download.',
apiVersion: '1.12.0',
i18nManifest: {
'zh-CN': {
name: '保存为 Markdown',
description: '保存为 Markdown 并下载',
},
'de-DE': { name: 'Als Markdown speichern', description: 'Als Markdown speichern und herunterladen.' },
'en-US': { name: 'Save as Markdown', description: 'Save as Markdown and Download.' },
'ja-JP': { name: 'Markdownとして保存', description: 'Markdownとして保存し、ダウンロードします。' },
'ko-KR': { name: 'Markdown으로 저장', description: 'Markdown으로 저장하고 다운로드합니다.' },
'ru-RU': { name: 'Сохранить как Markdown', description: 'Сохранить как Markdown и скачать.' },
'zh-CN': { name: '保存为 Markdown', description: '保存为 Markdown 并下载' },
},
},
},
{
init: ({ pathname }) => {
return pathname.startsWith('/plugin');
Expand Down
16 changes: 9 additions & 7 deletions src/extensions/extensions/web-clipper/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ export default class Link extends ToolExtension<any> {
autoRunExclude: [],
},
},
i18nManifest: {
'zh-CN': {
name: '链接',
description: '在文章末尾添加当前地址',
},
},
},
i18nManifest: {
'de-DE': { name: 'Link', description: 'Fügen Sie am Ende des Dokuments einen Link hinzu.' },
'en-US': { name: 'Link', description: 'Add link at the end of the document.' },
'ja-JP': { name: 'リンク', description: 'ドキュメントの最後にリンクを追加します。' },
'ko-KR': { name: '링크', description: '문서 끝에 링크를 추가합니다.' },
'ru-RU': { name: 'Ссылка', description: 'Добавить ссылку в конце документа.' },
'zh-CN': { name: '添加模版', description: '根据插件设置中的模板,添加内容,默认添加页面链接' },
}
},
{
run: async context => {
return {
Expand Down
10 changes: 6 additions & 4 deletions src/extensions/extensions/web-clipper/pangu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ export default new ToolExtension<SelectAreaPosition>(
description: 'Paranoid text spacing in JavaScript',
powerpack: false,
i18nManifest: {
'zh-CN': {
name: '盘古',
description: '所有的中文字和半形的英文、数字、符号之间插入空白。',
},
'de-DE': { name: 'Pangu', description: 'Fügen Sie Leerzeichen zwischen chinesischen und englischen Zeichen ein.' },
'en-US': { name: 'Pangu', description: 'Paranoid text spacing in JavaScript' },
'ja-JP': { name: 'Pangu', description: 'すべての中国語と半角英数字、記号の間に空白を挿入します。' },
'ko-KR': { name: 'Pangu', description: '모든 한자와 반각 영어, 숫자, 기호 사이에 공백을 삽입합니다.' },
'ru-RU': { name: 'Pangu', description: 'Вставка пробелов между китайскими и английскими символами.' },
'zh-CN': { name: 'Pangu', description: '所有的中文字和半形的英文、数字、符号之间插入空白。' },
},
},
{
Expand Down
Loading