Merge remote-tracking branch 'origin' into feat/cloud-sync-saika

This commit is contained in:
MingLiang Wang
2023-01-10 12:20:27 +08:00
42 changed files with 234 additions and 201 deletions
+1 -2
View File
@@ -10,6 +10,7 @@
},
"dependencies": {
"@affine/datacenter": "workspace:*",
"@affine/i18n": "workspace:*",
"@blocksuite/blocks": "0.3.1-20230109032243-37ad3ba",
"@blocksuite/editor": "0.3.1-20230109032243-37ad3ba",
"@blocksuite/icons": "^2.0.2",
@@ -27,7 +28,6 @@
"cmdk": "^0.1.20",
"css-spring": "^4.1.0",
"dayjs": "^1.11.7",
"i18next": "^21.9.1",
"lit": "^2.3.1",
"next": "13.1.0",
"next-debug-local": "^0.1.5",
@@ -36,7 +36,6 @@
"quill-cursors": "^4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "^11.18.4",
"yjs": "^13.5.44"
},
"devDependencies": {
+1 -1
View File
@@ -1,5 +1,5 @@
import { NotFoundTitle, PageContainer } from './styles';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
export const NotfoundPage = () => {
const { t } = useTranslation();
return (
@@ -23,7 +23,7 @@ import {
StyledModalFooter,
} from './style';
import bg from '@/components/contact-modal/bg.png';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
const linkList = [
{
icon: <GithubIcon />,
@@ -15,7 +15,7 @@ import { useTheme } from '@/providers/ThemeProvider';
import { EdgelessIcon, PaperIcon } from './Icons';
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
import { usePageHelper } from '@/hooks/use-page-helper';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
const PaperItem = ({ active }: { active?: boolean }) => {
const {
theme: {
@@ -3,7 +3,7 @@ import { IconButton, IconButtonProps } from '@/ui/button';
import { Tooltip } from '@/ui/tooltip';
import { ArrowDownIcon } from '@blocksuite/icons';
import { useModal } from '@/providers/GlobalModalProvider';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
export const QuickSearchButton = ({
onClick,
...props
@@ -16,7 +16,7 @@ import { usePageHelper } from '@/hooks/use-page-helper';
import { useConfirm } from '@/providers/ConfirmProvider';
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
import { toast } from '@/ui/toast';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
const PopoverContent = () => {
const { editor } = useAppState();
const { toggleFavoritePage, toggleDeletePage } = usePageHelper();
@@ -8,7 +8,7 @@ import {
import { CloseIcon, ContactIcon, HelpIcon, KeyboardIcon } from './Icons';
import Grow from '@mui/material/Grow';
import { Tooltip } from '@/ui/tooltip';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
import { useModal } from '@/providers/GlobalModalProvider';
import { useTheme } from '@/providers/ThemeProvider';
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
+1 -1
View File
@@ -6,7 +6,7 @@ import Loading from '@/components/loading';
import { usePageHelper } from '@/hooks/use-page-helper';
import { useAppState } from '@/providers/app-state-provider/context';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
// import { Tooltip } from '@/ui/tooltip';
type ImportModalProps = {
open: boolean;
@@ -14,7 +14,7 @@ import {
} from '@blocksuite/icons';
import { toast } from '@/ui/toast';
import { usePageHelper } from '@/hooks/use-page-helper';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
export const OperationCell = ({ pageMeta }: { pageMeta: PageMeta }) => {
const { id, favorite } = pageMeta;
const { openPage } = usePageHelper();
@@ -24,7 +24,7 @@ import { useAppState } from '@/providers/app-state-provider/context';
import { toast } from '@/ui/toast';
import { usePageHelper } from '@/hooks/use-page-helper';
import { useTheme } from '@/providers/ThemeProvider';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
const FavoriteTag = ({
pageMeta: { favorite, id },
}: {
@@ -4,7 +4,7 @@ import { StyledModalFooterContent } from './style';
import { useModal } from '@/providers/GlobalModalProvider';
import { Command } from 'cmdk';
import { usePageHelper } from '@/hooks/use-page-helper';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
export const Footer = (props: { query: string }) => {
const { triggerQuickSearchModal } = useModal();
const { openPage, createPage } = usePageHelper();
@@ -7,7 +7,7 @@ import { useAppState } from '@/providers/app-state-provider';
import { useRouter } from 'next/router';
import { useSwitchToConfig } from './config';
import { NoResultSVG } from './NoResultSVG';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
import usePageHelper from '@/hooks/use-page-helper';
import usePageMetaList from '@/hooks/use-page-meta-list';
export const Results = (props: {
@@ -1,5 +1,5 @@
import { AllPagesIcon, FavouritesIcon, TrashIcon } from '@blocksuite/icons';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
export const useSwitchToConfig = (
currentWorkspaceId: string
@@ -1,4 +1,4 @@
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
interface ShortcutTip {
[x: string]: string;
}
@@ -13,7 +13,7 @@ export const useMacKeyboardShortcuts = (): ShortcutTip => {
[t('Strikethrough')]: '⌘+⇧+S',
[t('Inline code')]: ' ⌘+E',
[t('Code block')]: '⌘+⌥+C',
[t('Hyperlink(with selected text)')]: '⌘+K',
[t('Link')]: '⌘+K',
[t('Quick search')]: '⌘+K',
[t('Body text')]: '⌘+⌥+0',
[t('Heading', { number: '1' })]: '⌘+⌥+1',
@@ -57,7 +57,7 @@ export const useWindowsKeyboardShortcuts = (): ShortcutTip => {
[t('Strikethrough')]: 'Ctrl+Shift+S',
[t('Inline code')]: ' Ctrl+E',
[t('Code block')]: 'Ctrl+Alt+C',
[t('Hyperlink(with selected text)')]: 'Ctrl+K',
[t('Link')]: 'Ctrl+K',
[t('Quick search')]: 'Ctrl+K',
[t('Body text')]: 'Ctrl+Shift+0',
[t('Heading', { number: '1' })]: 'Ctrl+Shift+1',
@@ -16,7 +16,7 @@ import {
import Slide from '@mui/material/Slide';
import { ModalCloseButton } from '@/ui/modal';
import { getUaHelper } from '@/utils';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
type ModalProps = {
open: boolean;
onClose: () => void;
@@ -30,7 +30,7 @@ import { IconButton } from '@/ui/button';
import useLocalStorage from '@/hooks/use-local-storage';
import usePageMetaList from '@/hooks/use-page-meta-list';
import { usePageHelper } from '@/hooks/use-page-helper';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
const FavoriteList = ({ showList }: { showList: boolean }) => {
const { openPage } = usePageHelper();
@@ -1,22 +0,0 @@
{
"// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "",
"Add A Below Block": "নীচে একটি ব্লক যোগ করুন",
"WarningTips": {
"IsNotfsApiSupported": "অ্যাফাইন ডেমোতে স্বাগতম। পরিবর্তনগুলি সংরক্ষণ করা শুরু করতে আপনি Chrome/Edge এর মতো ক্রোমিয়াম ভিত্তিক ব্রাউজারের সর্বশেষ সংস্করণের মাধ্যমে ডিস্কে ডেটা সিঙ্ক করতে পারেন",
"DoNotStore": "অ্যাফাইন সক্রিয় ডেভেলপমেন্ট এর অধীনে এবং বর্তমান সংস্করণটি অস্থিতিশীল। দয়া করে কোন তথ্য বা ডেটা সঞ্চয় করবেন না"
},
"Language": "ভাষা",
"Settings": "সেটিংস",
"Share": "শেয়ার করুন",
"Comment": "মন্তব্য",
"Delete": "মুছে ফেলুন",
"Copy Page Link": "পেজ লিংক কপি করুন",
"Duplicate Page": "সদৃশ পৃষ্ঠা তৈরি করুন",
"Logout": "লগআউট",
"Divide Here As A New Group": "একটি নতুন গ্রুপ হিসেবে বিভক্ত করুন",
"ComingSoon": "লেআউট সেটিংস শীঘ্রই আসছে...",
"Clear Workspace": "ওয়ার্কস্পেস পরিষ্কার করুন",
"Layout": "লেআউট",
"Turn into": "রূপান্তর করুন",
"Sync to Disk": "ডিস্ক এ সিঙ্ক করুন"
}
@@ -1,29 +0,0 @@
{
"// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "",
"ComingSoon": "Bientôt disponible",
"Duplicate Page": "Dupliquer la page",
"Copy Page Link": "Copier le lien de la page",
"Delete": "Supprimer",
"Comment": "Commentaire",
"Export As HTML": "Exporter en HTML",
"Export As Markdown": "Exporter en Markdown",
"Export As PDF (Unsupported)": "exporter en PDF (non supporté)",
"Logout": "Déconnexion",
"Export Workspace": "Exporter l'espace de travail",
"Import Workspace": "Importer l'espace de travail",
"Language": "Langue",
"Last edited by": "Dernière édition par {{name}}",
"Layout": "Mise en forme",
"Settings": "Réglages",
"Share": "Partager",
"Sync to Disk": "Synchroniser sur le disque",
"Turn into": "Transformer en",
"WarningTips": {
"DoNotStore": "Affine est en développement actif ; la version actuelle est INSTABLE. Veuillez NE PAS stocker d'informations ou de données",
"IsNotLocalWorkspace": "Bienvenue sur la démo d'AFFiNE. Pour commencer à sauvegarder vos modifications, vous pouvez SYNCHRONISER SUR LE DISQUE",
"IsNotfsApiSupported": "Bienvenue sur la démo d'AFFiNE. Pour commencer à sauvegarder vos modifications, vous pouvez SYNCHRONISER SUR LE DISQUE\navec la dernière version d'un navigateur basé sur Chromium tel que Chrome ou Edge."
},
"Add A Below Block": "Ajouter un bloc en-dessous",
"Divide Here As A New Group": "Séparer ici en un nouveau groupe",
"Clear Workspace": "Vider l'espace de travail"
}
@@ -1,27 +0,0 @@
{
"// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "",
"Clear Workspace": "Očisti radni prostor",
"ComingSoon": "Podešavanja za izgled dolaze",
"Comment": "Komentar",
"Copy Page Link": "Kopiraj link stranice",
"Delete": "Obriši",
"Duplicate Page": "Dupliraj stranicu",
"Export As HTML": "Izvezi kao HTML",
"Export As Markdown": "Izvezi kao Markdown",
"Export As PDF (Unsupported)": "Izvezi kao PDF (nepodržano)",
"Export Workspace": "Izvezi radnu površinu",
"Import Workspace": "Poboljšaj radnu površinu",
"Language": "Jezik",
"Last edited by": "Zadnju promenu uradio {{ime}}",
"Layout": "Izgled",
"Logout": "Odjava",
"Settings": "Podešavanja",
"Share": "Podeli",
"Sync to Disk": "Sinhroniziraj sa diskom",
"Turn into": "Promeni u",
"WarningTips": {
"DoNotStore": "AFFiNE je u stanju aktivnog razvoja i trenutna verzija je NESTABILNA. Molimo vas, NEMOJTE čuvati informacije ili podatke.",
"IsNotLocalWorkspace": "Dobrodošli u AFFiNE demo. Da bi započeli proces čuvanja promena možete kliknuti SINHRONIZUJ SA DISKOM.",
"IsNotfsApiSupported": "Dobrodošli u AFFiNE demo. Da bi započeli proces čuvanja promena možete SINHRONIZOVATI NA DISK sa poslednjom verzijom pretraživača tipa Chromium, kao što su Chrome/Edge."
}
}
@@ -1,29 +0,0 @@
{
"// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "",
"Sync to Disk": "同步到磁盘",
"Share": "分享",
"WarningTips": {
"IsNotfsApiSupported": "欢迎来到AFFiNE 的演示界面。您可以使用最新版本的基于Chrome的浏览器(如Chrome/Edge)将数据同步到磁盘来进行保存",
"IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。",
"DoNotStore": "AFFiNE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
},
"ComingSoon": "布局设置即将到来",
"Layout": "布局",
"Comment": "评论",
"Settings": "设置",
"Duplicate Page": "复制页面",
"Copy Page Link": "复制页面链接",
"Language": "当前语言",
"Clear Workspace": "清空工作区域",
"Export As Markdown": "导出 markdown",
"Export As HTML": "导出 HTML",
"Export As PDF (Unsupported)": "导出 PDF (暂不支持)",
"Import Workspace": "导入 Workspace",
"Export Workspace": "导出 Workspace",
"Last edited by": "最后编辑者为 {{name}}",
"Logout": "退出登录",
"Delete": "删除",
"Turn into": "转换为",
"Add A Below Block": "在下方添加一个新块",
"Divide Here As A New Group": "从这里划分一个新组"
}
@@ -1,29 +0,0 @@
{
"// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.": "",
"Add A Below Block": "在下方新添塊",
"Clear Workspace": "清空工作區",
"ComingSoon": "自定義佈局功能即將與您見面",
"Comment": "評論",
"Copy Page Link": "拷貝頁面鏈接",
"Delete": "刪除",
"Divide Here As A New Group": "從此地劃分成新組",
"Duplicate Page": "複製界面",
"Export As HTML": "導出 HTML",
"Export As Markdown": "以 Markdown 導出",
"Export As PDF (Unsupported)": "導出為 PDF(即將可用)",
"Export Workspace": "導出 Workspace",
"Import Workspace": "導入 Workspace",
"Language": "語言",
"Last edited by": "最後編輯者為 {{name}}",
"Layout": "佈局",
"Logout": "退出登錄",
"Settings": "設置",
"Share": "分享",
"Sync to Disk": "同步到磁盤",
"Turn into": "轉換為",
"WarningTips": {
"DoNotStore": "我們正在積極開發 AFFiNE,目前版本尚不穩定,請避免存儲信息或數據。",
"IsNotLocalWorkspace": "歡迎來到 AFFiNE 演示界面。您可以通過「同步到磁盤」來保存更改。",
"IsNotfsApiSupported": "歡迎進入AFFiNE演示!使用最新版本的基於 Chromium 內核的瀏覽器如Chrome/Edge,您可以通過「同步到磁盤」來保存更改"
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ import { useEffect } from 'react';
import { useAppState } from '@/providers/app-state-provider';
import { PageLoading } from '@/components/loading';
import Head from 'next/head';
import '@/libs/i18n';
import '@affine/i18n';
const ThemeProvider = dynamic(() => import('@/providers/ThemeProvider'), {
ssr: false,
@@ -4,7 +4,7 @@ import usePageMetaList from '@/hooks/use-page-meta-list';
import { PageListHeader } from '@/components/header';
import { ReactElement } from 'react';
import WorkspaceLayout from '@/components/workspace-layout';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
const All = () => {
const pageMetaList = usePageMetaList();
const { t } = useTranslation();
@@ -4,7 +4,7 @@ import { FavouritesIcon } from '@blocksuite/icons';
import usePageMetaList from '@/hooks/use-page-meta-list';
import { ReactElement } from 'react';
import WorkspaceLayout from '@/components/workspace-layout';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
export const Favorite = () => {
const pageMetaList = usePageMetaList();
const { t } = useTranslation();
@@ -4,7 +4,7 @@ import { TrashIcon } from '@blocksuite/icons';
import usePageMetaList from '@/hooks/use-page-meta-list';
import { ReactElement } from 'react';
import WorkspaceLayout from '@/components/workspace-layout';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
export const Trash = () => {
const pageMetaList = usePageMetaList();
const { t } = useTranslation();
+1 -1
View File
@@ -7,7 +7,7 @@ import {
StyledModalWrapper,
} from '@/ui/confirm/styles';
import { Button } from '@/ui/button';
import { useTranslation } from 'react-i18next';
import { useTranslation } from '@affine/i18n';
export type ConfirmProps = {
title?: string;
content?: string;
+29
View File
@@ -0,0 +1,29 @@
{
"name": "@affine/i18n",
"version": "0.1.0",
"description": "",
"main": "dist/src/index.js",
"type": "module",
"types": "dist/src/index.d.ts",
"exports": {
"./src/*": "./dist/src/*.js",
".": "./dist/src/index.js"
},
"scripts": {
"build": "tsc --project ./tsconfig.json"
},
"keywords": [],
"repository": {
"type": "git",
"url": "git+https://github.com/toeverything/AFFiNE.git"
},
"dependencies": {
"i18next": "^21.9.1",
"prettier": "^2.7.1",
"react-i18next": "^11.18.4"
},
"devDependencies": {
"@types/prettier": "^2.7.2",
"typescript": "^4.8.4"
}
}
@@ -1,10 +1,6 @@
import i18next, { Resource } from 'i18next';
import {
I18nextProvider,
initReactI18next,
useTranslation,
} from 'react-i18next';
import { LOCALES } from './resources';
import { initReactI18next, useTranslation } from 'react-i18next';
import { LOCALES } from './resources/index.js';
import type en_US from './resources/en.json';
// const localStorage = {
@@ -27,7 +23,7 @@ declare module 'react-i18next' {
// const STORAGE_KEY = 'i18n_lng';
export { i18n, useTranslation, I18nProvider, LOCALES };
export { i18n, useTranslation, LOCALES };
const resources = LOCALES.reduce<Resource>(
(acc, { tag, res }) => ({ ...acc, [tag]: { translation: res } }),
@@ -63,4 +59,4 @@ i18n.on('languageChanged', () => {
// localStorage.setItem(STORAGE_KEY, lng);
});
const I18nProvider = I18nextProvider;
// const I18nProvider = I18nextProvider;
+1
View File
@@ -0,0 +1 @@
{}
@@ -34,7 +34,7 @@
"Delete page?": "Delete page?",
"Delete permanently?": "Delete permanently?",
"will be moved to Trash": "{{title}} will be moved to Trash",
"Once deleted, you can't undo this action.": "Once deleted,you can't undo this action.",
"Once deleted, you can't undo this action.": "Once deleted, you can't undo this action.",
"Moved to Trash": "Moved to Trash",
"Permanently deleted": "Permanently deleted",
"restored": "{{title}} restored",
@@ -54,12 +54,26 @@
"Strikethrough": "Strikethrough",
"Inline code": "Inline code",
"Code block": "Code block",
"Hyperlink(with selected text)": "Hyperlink(with selected text)",
"Link": "Hyperlink(with selected text)",
"Body text": "Body text",
"Heading": "Heading {{number}}",
"Increase indent": "Increase indent",
"Reduce indent": "Reduce indent",
"Markdown Syntax": "Markdown Syntax",
"Divider": "Divider",
"404 - Page Not Found": "404 - Page Not Found"
"404 - Page Not Found": "404 - Page Not Found",
"New Workspace": "New Workspace",
"Workspace description": "Workspace is your virtual space to capture, create and plan as just one person or together as a team.",
"Create": "Create",
"Select": "Select",
"Text": "Text (coming soon)",
"Shape": "Shape",
"Sticky": "Sticky (coming soon)",
"Pen": "Pen (coming soon)",
"Connector": "Connector (coming soon)",
"Upload": "Upload",
"Restore it": "Restore it",
"TrashButtonGroupTitle": "Permanently delete",
"TrashButtonGroupDescription": "Once deleted, you can't undo this action. Do you confirm?",
"Delete permanently": "Delete permanently"
}
+1
View File
@@ -0,0 +1 @@
{}
+1
View File
@@ -0,0 +1 @@
{}
+65
View File
@@ -0,0 +1,65 @@
{
"Quick search": "快速搜索",
"All pages": "全部页面",
"Favourites": "收藏夹",
"No item": "没有项目",
"Import": "导入",
"Trash": "回收站",
"New Page": "新建文章",
"New Keyword Page": "新建 '{{query}}' 为标题的文章",
"Find 0 result": "找到 0 个结果",
"Find results": "找到 {{number}} 个结果",
"Collapse sidebar": "关闭侧边栏",
"Expand sidebar": "展开侧边栏",
"Removed from Favourites": "已从收藏中移除",
"Remove from favourites": "从收藏中移除",
"Added to Favourites": "已添加到收藏",
"Add to favourites": "添加到收藏",
"Paper": "文章",
"Edgeless": "无边模式",
"Switch to": "跳转到",
"Convert to ": "转换成 ",
"Page": "文章",
"Export": "导出",
"Export to HTML": "导出到 HTML",
"Export to Markdown": "导出到 Markdown",
"Delete": "删除",
"Title": "标题",
"Untitled": "无标题",
"Created": "创建时间",
"Updated": "更新时间",
"Open in new tab": "在新页面打开",
"Favourite": "收藏",
"Favourited": "已收藏",
"Delete page?": "删除文章?",
"Delete permanently?": "永久删除?",
"will be moved to Trash": "{{title}} 将被移动到回收站",
"Once deleted, you can't undo this action.": "一次性删除,无法恢复。",
"Moved to Trash": "已移动到回收站",
"Permanently deleted": "已永久删除",
"restored": "{{title}} 已恢复",
"Cancel": "取消",
"Keyboard Shortcuts": "快捷键",
"Contact Us": "联系我们",
"Official Website": "官网",
"Get in touch!": "Get in touch!",
"AFFiNE Community": "AFFiNE Community",
"How is AFFiNE Alpha different?": "How is AFFiNE Alpha different?",
"Shortcuts": "Shortcuts",
"Undo": "Undo",
"Redo": "Redo",
"Bold": "Bold",
"Italic": "Italic",
"Underline": "Underline",
"Strikethrough": "Strikethrough",
"Inline code": "Inline code",
"Code block": "Code block",
"Link": "Link",
"Body text": "Body text",
"Heading": "Heading {{number}}",
"Increase indent": "Increase indent",
"Reduce indent": "Reduce indent",
"Markdown Syntax": "Markdown Syntax",
"Divider": "Divider",
"404 - Page Not Found": "404 - Page Not Found"
}
+1
View File
@@ -0,0 +1 @@
{}
@@ -43,7 +43,19 @@ import { fetchTolgee } from './request';
* ]
* ```
*/
export const getAllProjectLanguages = async (size = 1000) => {
export const getAllProjectLanguages = async (
size = 1000
): Promise<
{
id: number;
name: string;
tag: string;
originalName: string;
flagEmoji: string;
base: boolean;
}[]
> => {
const url = `/languages?size=${size}`;
const resp = await fetchTolgee(url);
if (resp.status < 200 || resp.status >= 300) {
@@ -70,7 +82,7 @@ export const getAllProjectLanguages = async (size = 1000) => {
*
* See https://tolgee.io/api#operation/getTranslations_
*/
export const getTranslations = async () => {
export const getTranslations = async (): Promise<unknown> => {
const url = '/translations';
const resp = await fetchTolgee(url);
if (resp.status < 200 || resp.status >= 300) {
@@ -87,17 +99,19 @@ export const getTranslations = async () => {
*/
export const getLanguagesTranslations = async <T extends string>(
languages: T
) => {
): Promise<{ [key in T]?: Record<string, string> }> => {
const url = `/translations/${languages}`;
const resp = await fetchTolgee(url);
if (resp.status < 200 || resp.status >= 300) {
throw new Error(url + ' ' + resp.status + '\n' + (await resp.text()));
}
const json: { [key in T]?: Record<string, string> } = await resp.json();
const json = await resp.json();
return json;
};
export const getRemoteTranslations = async (languages: string) => {
export const getRemoteTranslations = async (
languages: string
): Promise<Record<string, string>> => {
const translations = await getLanguagesTranslations(languages);
if (!(languages in translations)) {
return {};
@@ -115,7 +129,7 @@ export const getRemoteTranslations = async (languages: string) => {
export const createsNewKey = async (
key: string,
translations: Record<string, string>
) => {
): Promise<unknown> => {
const url = '/translations/keys/create';
const resp = await fetchTolgee(url, {
method: 'POST',
@@ -133,7 +147,10 @@ export const createsNewKey = async (
*
* See https://tolgee.io/api#operation/tagKey_1
*/
export const addTag = async (keyId: string, tagName: string) => {
export const addTag = async (
keyId: string,
tagName: string
): Promise<unknown> => {
const url = `/keys/${keyId}/tags`;
const resp = await fetchTolgee(url, {
method: 'PUT',
@@ -151,7 +168,10 @@ export const addTag = async (keyId: string, tagName: string) => {
*
* See https://tolgee.io/api#operation/tagKey_1
*/
export const removeTag = async (keyId: string, tagId: number) => {
export const removeTag = async (
keyId: string,
tagId: number
): Promise<unknown> => {
const url = `/keys/${keyId}/tags/${tagId}`;
const resp = await fetchTolgee(url, {
method: 'DELETE',
@@ -174,7 +194,7 @@ export const removeTag = async (keyId: string, tagId: number) => {
*
* See https://tolgee.io/api#operation/export_1
*/
export const exportResources = async () => {
export const exportResources = async (): Promise<Response> => {
const url = `/export`;
const resp = await fetchTolgee(url);
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": false,
"esModuleInterop": true,
"module": "ESNext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"experimentalDecorators": true,
"declaration": true,
"baseUrl": ".",
"rootDir": ".",
"outDir": "./dist"
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"]
}
+38 -21
View File
@@ -41,6 +41,7 @@ importers:
packages/app:
specifiers:
'@affine/datacenter': workspace:*
'@affine/i18n': workspace:*
'@blocksuite/blocks': 0.3.1-20230109032243-37ad3ba
'@blocksuite/editor': 0.3.1-20230109032243-37ad3ba
'@blocksuite/icons': ^2.0.2
@@ -67,7 +68,6 @@ importers:
eslint-config-next: 12.3.1
eslint-config-prettier: ^8.5.0
eslint-plugin-prettier: ^4.2.1
i18next: ^21.9.1
lit: ^2.3.1
next: 13.1.0
next-debug-local: ^0.1.5
@@ -78,11 +78,11 @@ importers:
raw-loader: ^4.0.2
react: 18.2.0
react-dom: 18.2.0
react-i18next: ^11.18.4
typescript: 4.8.3
yjs: ^13.5.44
dependencies:
'@affine/datacenter': link:../data-center
'@affine/i18n': link:../i18n
'@blocksuite/blocks': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44
'@blocksuite/editor': 0.3.1-20230109032243-37ad3ba_yjs@13.5.44
'@blocksuite/icons': 2.0.4_w5j4k42lgipnm43s3brx6h3c34
@@ -100,7 +100,6 @@ importers:
cmdk: 0.1.21_7ey2zzynotv32rpkwno45fsx4e
css-spring: 4.1.0
dayjs: 1.11.7
i18next: 21.10.0
lit: 2.4.0
next: 13.1.0_biqbaboplfbrettd7655fr4n2y
next-debug-local: 0.1.5
@@ -109,7 +108,6 @@ importers:
quill-cursors: 4.0.0
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
react-i18next: 11.18.6_vfm63zmruocgezzfl2v26zlzpy
yjs: 13.5.44
devDependencies:
'@types/node': 18.7.18
@@ -162,6 +160,21 @@ importers:
fake-indexeddb: 4.0.1
typescript: 4.9.3
packages/i18n:
specifiers:
'@types/prettier': ^2.7.2
i18next: ^21.9.1
prettier: ^2.7.1
react-i18next: ^11.18.4
typescript: ^4.8.4
dependencies:
i18next: 21.10.0
prettier: 2.7.1
react-i18next: 11.18.6_i18next@21.10.0
devDependencies:
'@types/prettier': 2.7.2
typescript: 4.9.3
packages/logger:
specifiers:
'@types/react': ^18.0.21
@@ -1363,6 +1376,7 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
regenerator-runtime: 0.13.9
dev: false
/@babel/runtime/7.20.7:
resolution: {integrity: sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==}
@@ -1706,7 +1720,7 @@ packages:
dependencies:
'@babel/helper-module-imports': 7.18.6
'@babel/plugin-syntax-jsx': 7.18.6
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
'@emotion/hash': 0.9.0
'@emotion/memoize': 0.8.0
'@emotion/serialize': 1.1.0
@@ -2588,7 +2602,7 @@ packages:
'@types/react':
optional: true
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
'@mui/utils': 5.10.9_react@18.2.0
'@types/react': 18.0.20
prop-types: 15.8.1
@@ -2608,7 +2622,7 @@ packages:
'@emotion/styled':
optional: true
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
'@emotion/cache': 11.10.3
'@emotion/react': 11.10.4_w5j4k42lgipnm43s3brx6h3c34
'@emotion/styled': 11.10.4_yiaqs725o7pcd7rteavrnhgj4y
@@ -2633,7 +2647,7 @@ packages:
'@types/react':
optional: true
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
'@emotion/react': 11.10.4_w5j4k42lgipnm43s3brx6h3c34
'@emotion/styled': 11.10.4_yiaqs725o7pcd7rteavrnhgj4y
'@mui/private-theming': 5.10.9_w5j4k42lgipnm43s3brx6h3c34
@@ -2664,7 +2678,7 @@ packages:
peerDependencies:
react: ^17.0.0 || ^18.0.0
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
'@types/prop-types': 15.7.5
'@types/react-is': 17.0.3
prop-types: 15.8.1
@@ -3349,6 +3363,10 @@ packages:
resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==}
dev: false
/@types/prettier/2.7.2:
resolution: {integrity: sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==}
dev: true
/@types/prop-types/15.7.5:
resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==}
@@ -3706,7 +3724,7 @@ packages:
resolution: {integrity: sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==}
engines: {node: '>=6.0'}
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
'@babel/runtime-corejs3': 7.19.1
dev: true
@@ -3811,7 +3829,7 @@ packages:
resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==}
engines: {node: '>=10', npm: '>=6'}
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
cosmiconfig: 7.0.1
resolve: 1.22.1
dev: false
@@ -4376,7 +4394,7 @@ packages:
/dom-helpers/5.2.1:
resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==}
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
csstype: 3.1.1
dev: false
@@ -4743,7 +4761,7 @@ packages:
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
aria-query: 4.2.2
array-includes: 3.1.5
ast-types-flow: 0.0.7
@@ -4765,7 +4783,7 @@ packages:
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
aria-query: 4.2.2
array-includes: 3.1.5
ast-types-flow: 0.0.7
@@ -5597,7 +5615,7 @@ packages:
/i18next/21.10.0:
resolution: {integrity: sha512-YeuIBmFsGjUfO3qBmMOc0rQaun4mIpGKET5WDwvu8lU7gvwpcariZLNtL0Fzj+zazcHUrlXHiptcFhBMFaxzfg==}
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
dev: false
/iconv-lite/0.4.24:
@@ -6887,6 +6905,7 @@ packages:
/prettier/2.7.1:
resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==}
engines: {node: '>=10.13.0'}
hasBin: true
/pretty-bytes/5.6.0:
resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==}
@@ -7013,7 +7032,7 @@ packages:
react: 18.2.0
scheduler: 0.23.0
/react-i18next/11.18.6_vfm63zmruocgezzfl2v26zlzpy:
/react-i18next/11.18.6_i18next@21.10.0:
resolution: {integrity: sha512-yHb2F9BiT0lqoQDt8loZ5gWP331GwctHz9tYQ8A2EIEUu+CcEdjBLQWli1USG3RdWQt3W+jqQLg/d4rrQR96LA==}
peerDependencies:
i18next: '>= 19.0.0'
@@ -7026,11 +7045,9 @@ packages:
react-native:
optional: true
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
html-parse-stringify: 3.0.1
i18next: 21.10.0
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
dev: false
/react-is/16.13.1:
@@ -7098,7 +7115,7 @@ packages:
react: '>=16.6.0'
react-dom: '>=16.6.0'
dependencies:
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
dom-helpers: 5.2.1
loose-envify: 1.4.0
prop-types: 15.8.1
@@ -8282,7 +8299,7 @@ packages:
'@apideck/better-ajv-errors': 0.3.6_ajv@8.11.2
'@babel/core': 7.20.5
'@babel/preset-env': 7.20.2_@babel+core@7.20.5
'@babel/runtime': 7.19.0
'@babel/runtime': 7.20.7
'@rollup/plugin-babel': 5.3.1_opjstonlpkhafnz76jsxdwq25a
'@rollup/plugin-node-resolve': 11.2.1_rollup@2.79.1
'@rollup/plugin-replace': 2.4.2_rollup@2.79.1