Skip to content

Commit

Permalink
refactor: move file service into a monorepo project (DimensionDev#5273)
Browse files Browse the repository at this point in the history
* refactor: move file service

* fix: type error

* fix: build error

* fix: everything

* chore: move file

* chore: move file

* chore: move i18n strings
  • Loading branch information
Jack-Works authored Dec 24, 2021
1 parent ad85ee3 commit edcaafc
Show file tree
Hide file tree
Showing 105 changed files with 517 additions and 374 deletions.
12 changes: 12 additions & 0 deletions .i18n-codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@
"trans": "Translate",
"sourceMap": "inline"
}
},
{
"input": "./packages/plugins/FileService/src/locales/en-US.json",
"output": "./packages/plugins/FileService/src/locales/i18n_generated",
"parser": "i18next",
"generator": {
"type": "i18next/react-hooks",
"hooks": "useI18N",
"namespace": "com.maskbook.fileservice",
"trans": "Translate",
"sourceMap": "inline"
}
}
]
}
2 changes: 1 addition & 1 deletion packages/dashboard/src/entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

export { IntegratedDashboard } from './Dashboard'
export { setService, setPluginMessages, setMessages, setPluginServices } from './API'
export { addDashboardI18N } from './locales'
export { addDashboardI18N } from './locales/languages'
2 changes: 1 addition & 1 deletion packages/dashboard/src/initialization/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import i18n from 'i18next'
import Detector from 'i18next-browser-languagedetector'
import { addSharedI18N } from '@masknet/shared'
import { fallbackLng } from '@masknet/shared-base'
import { addDashboardI18N } from '../locales'
import { addDashboardI18N } from '../locales/languages'
import { initReactI18next } from 'react-i18next'

i18n.use(Detector).init({
Expand Down
16 changes: 0 additions & 16 deletions packages/dashboard/src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,5 @@
// Run `npx gulp sync-languages` to regenerate.
// Default fallback language in a family of languages are chosen by the alphabet order
// To overwrite this, please overwrite packages/scripts/src/locale-kit-next/index.ts
import en_US from './en-US.json'
import ja_JP from './ja-JP.json'
import ko_KR from './ko-KR.json'
import qya_AA from './qya-AA.json'
import zh_CN from './zh-CN.json'
import zh_TW from './zh-TW.json'

export * from './i18n_generated'
export const languages = {
en: en_US,
ja: ja_JP,
ko: ko_KR,
qy: qya_AA,
'zh-CN': zh_CN,
zh: zh_TW,
}
import { createI18NBundle } from '@masknet/shared-base'
export const addDashboardI18N = createI18NBundle('dashboard', languages)
20 changes: 20 additions & 0 deletions packages/dashboard/src/locales/languages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This file is auto generated. DO NOT EDIT
// Run `npx gulp sync-languages` to regenerate.
// Default fallback language in a family of languages are chosen by the alphabet order
// To overwrite this, please overwrite packages/scripts/src/locale-kit-next/index.ts
import en_US from './en-US.json'
import ja_JP from './ja-JP.json'
import ko_KR from './ko-KR.json'
import qya_AA from './qya-AA.json'
import zh_CN from './zh-CN.json'
import zh_TW from './zh-TW.json'
export const languages = {
en: en_US,
ja: ja_JP,
ko: ko_KR,
qy: qya_AA,
'zh-CN': zh_CN,
zh: zh_TW,
}
import { createI18NBundle } from '@masknet/shared-base'
export const addDashboardI18N = createI18NBundle('dashboard', languages)
1 change: 1 addition & 0 deletions packages/mask/.webpack/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function createConfiguration(rawFlags: BuildFlags): Configuration {
'@masknet/plugin-example': join(__dirname, '../../plugins/example/src/'),
'@masknet/plugin-flow': join(__dirname, '../../plugins/Flow/src/'),
'@masknet/plugin-wallet': join(__dirname, '../../plugins/Wallet/src/'),
'@masknet/plugin-file-service': join(__dirname, '../../plugins/FileService/src/'),
'@masknet/external-plugin-previewer': join(__dirname, '../../external-plugin-previewer/src/'),
'@masknet/public-api': join(__dirname, '../../public-api/src/'),
'@masknet/sdk': join(__dirname, '../../mask-sdk/server/'),
Expand Down
1 change: 1 addition & 0 deletions packages/mask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@masknet/icons": "workspace:*",
"@masknet/injected-script": "workspace:*",
"@masknet/plugin-example": "workspace:*",
"@masknet/plugin-file-service": "workspace:*",
"@masknet/plugin-flow": "workspace:*",
"@masknet/plugin-infra": "workspace:*",
"@masknet/plugin-wallet": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions packages/mask/shared-ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './locales'
export * from './locales/languages'
// DO NOT EXPORT THIS
// export * from './locales_legacy'
24 changes: 0 additions & 24 deletions packages/mask/shared-ui/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,30 +382,6 @@
"plugin_gitcoin_last_updated": "Last update:",
"plugin_gitcoin_by": "By",
"plugin_gitcoin_view_on": "View on Gitcoin",
"plugin_file_service_display_name": "Plugin: File Service",
"plugin_file_service_on_insert": "Use the file",
"plugin_file_service_uploading_preparing": "Preparing",
"plugin_file_service_uploading_estimating_time": "Estimating time…",
"plugin_file_service_uploading_in_minute_remaining": "{{seconds}}s remaining",
"plugin_file_service_uploading_remaining": "{{minutes}}m {{seconds}}s remaining",
"plugin_file_service_uploading_on_cancel": "Uploading… Please do not close this page.",
"plugin_file_service_recent_files": "Recent files",
"plugin_file_service_show_more": "Show More",
"plugin_file_service_file_key": "File Key:",
"plugin_file_service_unencrypted": "This file is not encrypted",
"plugin_file_service_signing_failed": "Service unavailable. Wait a few minutes and try again.",
"plugin_file_service_on_encrypt_it": "Make It Encrypted",
"plugin_file_service_use_cdn": "Use Meson CDN",
"plugin_file_service_legal_text": "By using this plugin, you agree to the <terms>terms</terms> and the <policy>privacy policy</policy>.",
"plugin_file_service_legal_terms_link": "https://legal.mask.io/arweave/file-service/plugin-terms.html",
"plugin_file_service_legal_policy_link": "https://legal.mask.io/arweave/file-service/privacy-policy-uploader.html",
"plugin_file_service_drop_indicator": "Drop to upload",
"plugin_file_service_drop_hint_1": "Size limit: {{limit}}.",
"plugin_file_service_drop_hint_2": "The file will be uploaded immediately and cannot be canceled.",
"plugin_file_service_drop_here": "Drop a file here to upload",
"plugin_file_service_error_101": "The input is not a single file.",
"plugin_file_service_error_102": "The file is too large; limit is {{limit}}.",
"plugin_file_service_on_change_file": "Change File",
"plugin_trader_fail_to_load": "Fail to load trending info from ",
"plugin_trader_lbp_pool_in_balancer": "LBP Pool in Balancer",
"plugin_trader_tutorial": "Tutorial",
Expand Down
16 changes: 0 additions & 16 deletions packages/mask/shared-ui/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,5 @@
// Run `npx gulp sync-languages` to regenerate.
// Default fallback language in a family of languages are chosen by the alphabet order
// To overwrite this, please overwrite packages/scripts/src/locale-kit-next/index.ts
import en_US from './en-US.json'
import ja_JP from './ja-JP.json'
import ko_KR from './ko-KR.json'
import qya_AA from './qya-AA.json'
import zh_CN from './zh-CN.json'
import zh_TW from './zh-TW.json'

export * from './i18n_generated'
export const languages = {
en: en_US,
ja: ja_JP,
ko: ko_KR,
qy: qya_AA,
'zh-CN': zh_CN,
zh: zh_TW,
}
import { createI18NBundle } from '@masknet/shared-base'
export const addMaskI18N = createI18NBundle('mask', languages)
21 changes: 0 additions & 21 deletions packages/mask/shared-ui/locales/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,27 +172,6 @@
"plugin_gitcoin_donate": "寄付する",
"plugin_gitcoin_last_updated": "最新の更新:",
"plugin_gitcoin_view_on": "Gitcoin で見る",
"plugin_file_service_display_name": "プラグイン: ファイル共有",
"plugin_file_service_on_insert": "ファイルを使用する",
"plugin_file_service_uploading_preparing": "準備中",
"plugin_file_service_uploading_estimating_time": "転送時間を計算中...",
"plugin_file_service_uploading_in_minute_remaining": "残り: {{seconds}}秒",
"plugin_file_service_uploading_remaining": "残り: {{minutes}}分{{seconds}}秒",
"plugin_file_service_uploading_on_cancel": "アップロードしています…今このページを閉じないでください。",
"plugin_file_service_recent_files": "最近のファイル",
"plugin_file_service_show_more": "更に",
"plugin_file_service_unencrypted": "このファイルは暗号化されていません。",
"plugin_file_service_signing_failed": "サービスが使用できません。今しばらくお待ちください。",
"plugin_file_service_on_encrypt_it": "暗号化しましょう",
"plugin_file_service_use_cdn": "Mesonを使用して加速する",
"plugin_file_service_legal_text": "このプラグインを使用することで<terms>利用規約</terms>並びに<policy>プライバシーポリシー</policy>に同意したこととなります。",
"plugin_file_service_drop_indicator": "ファイルをドラッグ&ドロップしてアップロード!",
"plugin_file_service_drop_hint_1": "ファイル容量の超過:{{limit}}",
"plugin_file_service_drop_hint_2": "このファイルはすぐにアップロードされ、取り消すことはできません。",
"plugin_file_service_drop_here": "ファイルをここにドラッグ&ドロップ",
"plugin_file_service_error_101": "一つのファイルだけにしてください!",
"plugin_file_service_error_102": "ファイルが大きすぎます!最大容量は {{limit}} です。",
"plugin_file_service_on_change_file": "ファイルの変更",
"plugin_trader_swap": "スワップ",
"plugin_trader_wrap": "ラップ",
"plugin_trader_unwrap": "アンラップ",
Expand Down
24 changes: 0 additions & 24 deletions packages/mask/shared-ui/locales/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,30 +339,6 @@
"plugin_gitcoin_last_updated": "신규 업데이트",
"plugin_gitcoin_by": "By",
"plugin_gitcoin_view_on": "Gitcoin에서 보기",
"plugin_file_service_display_name": "플러그인: 파일 서비스",
"plugin_file_service_on_insert": "파일 사용",
"plugin_file_service_uploading_preparing": "준비 중",
"plugin_file_service_uploading_estimating_time": "남은 시간 계산 중",
"plugin_file_service_uploading_in_minute_remaining": "남은 시간 {{seconds}}s",
"plugin_file_service_uploading_remaining": "남은 시간 {{minutes}}m {{seconds}}s",
"plugin_file_service_uploading_on_cancel": "업로딩 중, 이 페이지를 닫지 마세요.",
"plugin_file_service_recent_files": "최근 파일",
"plugin_file_service_show_more": "더보기",
"plugin_file_service_file_key": "파일 키",
"plugin_file_service_unencrypted": "암호화되지 않는 파일입니다.",
"plugin_file_service_signing_failed": "사용 안 되는 서비스입니다. 잠시 후 다시 시도하세요.",
"plugin_file_service_on_encrypt_it": "암호화하기",
"plugin_file_service_use_cdn": "Meson CDN를 이용하기",
"plugin_file_service_legal_text": "이 플러그인을 이용하면 <terms>이용약관</terms>과 <policy>개인정보처리방침</policy>을 동의함으로 간주합니다",
"plugin_file_service_legal_terms_link": "https://legal.mask.io/arweave/file-service/plugin-terms.html",
"plugin_file_service_legal_policy_link": "https://legal.mask.io/arweave/file-service/privacy-policy-uploader.html",
"plugin_file_service_drop_indicator": "파일을 끌어들여 업로드하기",
"plugin_file_service_drop_hint_1": "크기 제한: {{limit}}.",
"plugin_file_service_drop_hint_2": "이 파일 즉시 업로드되겠습니다. 취소가 불가능합니다.",
"plugin_file_service_drop_here": "여기서 파일을 끌어들여 업로드하기",
"plugin_file_service_error_101": "단일 파일만 가능합니다.",
"plugin_file_service_error_102": "이 파일은 너무 큽니다. 크기 제한: {{limit}}.",
"plugin_file_service_on_change_file": "다른 파일로 바꾸기",
"plugin_trader_safety_alert_title": "토큰 안정성 알림",
"plugin_trader_safety_alert": "누구나 ERC20 토큰을 만들고 이름을 지을 수 있다. 토큰이 없는 프로젝트를 대표한다고 주장하는 토큰과 현존 토큰의 가짜 버전을 만드는 경우도 많습니다. Etherscan과 마찬가지로 이 사이트는 모든 ERC20 토큰에 대한 분석을 자동으로 추적합니다. ERC20 토큰과 상호 작용하기 전에 미리 잘 조사하시길 바랍니다.",
"plugin_trader_total_supply": "총 공급량",
Expand Down
20 changes: 20 additions & 0 deletions packages/mask/shared-ui/locales/languages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This file is auto generated. DO NOT EDIT
// Run `npx gulp sync-languages` to regenerate.
// Default fallback language in a family of languages are chosen by the alphabet order
// To overwrite this, please overwrite packages/scripts/src/locale-kit-next/index.ts
import en_US from './en-US.json'
import ja_JP from './ja-JP.json'
import ko_KR from './ko-KR.json'
import qya_AA from './qya-AA.json'
import zh_CN from './zh-CN.json'
import zh_TW from './zh-TW.json'
export const languages = {
en: en_US,
ja: ja_JP,
ko: ko_KR,
qy: qya_AA,
'zh-CN': zh_CN,
zh: zh_TW,
}
import { createI18NBundle } from '@masknet/shared-base'
export const addMaskI18N = createI18NBundle('mask', languages)
24 changes: 0 additions & 24 deletions packages/mask/shared-ui/locales/qya-AA.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,30 +381,6 @@
"plugin_gitcoin_last_updated": "crwdns4803:0crwdne4803:0",
"plugin_gitcoin_by": "crwdns4805:0crwdne4805:0",
"plugin_gitcoin_view_on": "crwdns4807:0crwdne4807:0",
"plugin_file_service_display_name": "crwdns4809:0crwdne4809:0",
"plugin_file_service_on_insert": "crwdns4811:0crwdne4811:0",
"plugin_file_service_uploading_preparing": "crwdns4813:0crwdne4813:0",
"plugin_file_service_uploading_estimating_time": "crwdns4815:0crwdne4815:0",
"plugin_file_service_uploading_in_minute_remaining": "crwdns4817:0{{seconds}}crwdne4817:0",
"plugin_file_service_uploading_remaining": "crwdns4819:0{{minutes}}crwdnd4819:0{{seconds}}crwdne4819:0",
"plugin_file_service_uploading_on_cancel": "crwdns7915:0crwdne7915:0",
"plugin_file_service_recent_files": "crwdns4823:0crwdne4823:0",
"plugin_file_service_show_more": "crwdns4825:0crwdne4825:0",
"plugin_file_service_file_key": "crwdns4827:0crwdne4827:0",
"plugin_file_service_unencrypted": "crwdns4829:0crwdne4829:0",
"plugin_file_service_signing_failed": "crwdns4831:0crwdne4831:0",
"plugin_file_service_on_encrypt_it": "crwdns4833:0crwdne4833:0",
"plugin_file_service_use_cdn": "crwdns4835:0crwdne4835:0",
"plugin_file_service_legal_text": "crwdns4837:0crwdne4837:0",
"plugin_file_service_legal_terms_link": "crwdns4839:0crwdne4839:0",
"plugin_file_service_legal_policy_link": "crwdns4841:0crwdne4841:0",
"plugin_file_service_drop_indicator": "crwdns4843:0crwdne4843:0",
"plugin_file_service_drop_hint_1": "crwdns4845:0{{limit}}crwdne4845:0",
"plugin_file_service_drop_hint_2": "crwdns4847:0crwdne4847:0",
"plugin_file_service_drop_here": "crwdns4849:0crwdne4849:0",
"plugin_file_service_error_101": "crwdns4851:0crwdne4851:0",
"plugin_file_service_error_102": "crwdns4853:0{{limit}}crwdne4853:0",
"plugin_file_service_on_change_file": "crwdns4855:0crwdne4855:0",
"plugin_trader_fail_to_load": "crwdns10207:0crwdne10207:0",
"plugin_trader_lbp_pool_in_balancer": "crwdns10209:0crwdne10209:0",
"plugin_trader_tutorial": "crwdns10211:0crwdne10211:0",
Expand Down
22 changes: 0 additions & 22 deletions packages/mask/shared-ui/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,28 +377,6 @@
"plugin_gitcoin_last_updated": "最新更新:",
"plugin_gitcoin_by": "提供者为:",
"plugin_gitcoin_view_on": "在 Gitcoin 上查看",
"plugin_file_service_display_name": "插件:文件服务",
"plugin_file_service_on_insert": "使用该文件",
"plugin_file_service_uploading_preparing": "准备中",
"plugin_file_service_uploading_estimating_time": "预计时间…",
"plugin_file_service_uploading_in_minute_remaining": "剩余 {{seconds}}秒",
"plugin_file_service_uploading_remaining": "剩余 {{minutes}}分钟 {{seconds}}秒",
"plugin_file_service_uploading_on_cancel": "上传中…请不要关闭此页面。",
"plugin_file_service_recent_files": "最近使用的文件",
"plugin_file_service_show_more": "显示更多",
"plugin_file_service_file_key": "文件密钥:",
"plugin_file_service_unencrypted": "此文件未加密",
"plugin_file_service_signing_failed": "服务暂不可用。请等待几分钟后重试。",
"plugin_file_service_on_encrypt_it": "进行加密",
"plugin_file_service_use_cdn": "使用Meson CDN",
"plugin_file_service_legal_text": "使用此插件,均表明您同意 <terms>使用条款</terms> 和 <policy>隐私政策</policy>。",
"plugin_file_service_drop_indicator": "拖放文件以上传",
"plugin_file_service_drop_hint_1": "大小限制: {{limit}}",
"plugin_file_service_drop_hint_2": "文件将立即上传,无法取消。",
"plugin_file_service_drop_here": "将文件拖放到此处来上传。",
"plugin_file_service_error_101": "此输入不是单个文件。",
"plugin_file_service_error_102": "文件太大,限制为 {{limit}}。",
"plugin_file_service_on_change_file": "更改文件",
"plugin_trader_fail_to_load": "无法加载趋势信息自 ",
"plugin_trader_lbp_pool_in_balancer": "Balancer 的 LBP 池",
"plugin_trader_tutorial": "教程",
Expand Down
22 changes: 0 additions & 22 deletions packages/mask/shared-ui/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,28 +304,6 @@
"plugin_gitcoin_last_updated": "最近更新:",
"plugin_gitcoin_by": "提供者為",
"plugin_gitcoin_view_on": "在 Gitcoin 觀看",
"plugin_file_service_display_name": "插件:檔案服務",
"plugin_file_service_on_insert": "使用這個檔案",
"plugin_file_service_uploading_preparing": "準備中",
"plugin_file_service_uploading_estimating_time": "預估時間…",
"plugin_file_service_uploading_in_minute_remaining": "剩下 {{seconds}} 秒",
"plugin_file_service_uploading_remaining": "剩下 {{minutes}} 分 {{seconds}} 秒",
"plugin_file_service_uploading_on_cancel": "上傳中… 請勿關閉這個頁面。",
"plugin_file_service_recent_files": "最近的檔案",
"plugin_file_service_show_more": "顯示更多",
"plugin_file_service_file_key": "檔案金鑰:",
"plugin_file_service_unencrypted": "這個檔案未加密",
"plugin_file_service_signing_failed": "服務無法使用。 請稍等幾分鐘,然後重試。",
"plugin_file_service_on_encrypt_it": "加密它",
"plugin_file_service_use_cdn": "使用 Meson CDN",
"plugin_file_service_legal_text": "使用此插件表示您同意<terms>使用者條約</terms>和<policy>隱私權政策</policy>。",
"plugin_file_service_drop_indicator": "拖入檔案以上傳",
"plugin_file_service_drop_hint_1": "檔案大小限制:{{limit}}。",
"plugin_file_service_drop_hint_2": "檔案將立即被上傳而且無法取消。",
"plugin_file_service_drop_here": "在這裡拖入一個檔案以上傳",
"plugin_file_service_error_101": "輸入的檔案不是單一檔案",
"plugin_file_service_error_102": "檔案太大; 檔案大小限制是 {{limit}}。",
"plugin_file_service_on_change_file": "更改檔案",
"plugin_trader_tutorial": "新手教學",
"plugin_trader_safety_agree": "我瞭解",
"plugin_trader_total_supply": "供應總量",
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/shared-ui/locales_legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { TOptions } from 'i18next'
import type en from '../locales/en-US.json'
import Detector from 'i18next-browser-languagedetector'

import { addMaskI18N } from '../locales'
import { addMaskI18N } from '../locales/languages'
import { addSharedI18N } from '@masknet/shared'
import { fallbackLng } from '@masknet/shared-base'
// @ts-ignore in case circle dependency make typescript complains
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { debugModeSetting } from '../../settings/settings'
import { ClickableChip } from '../shared/SelectRecipients/ClickableChip'
import { SelectRecipientsUI } from '../shared/SelectRecipients/SelectRecipients'
import type { Profile } from '../../database'
import { CompositionContext } from './CompositionContext'
import { CompositionContext } from '@masknet/plugin-infra'
import { DebugMetadataInspector } from '../shared/DebugMetadataInspector'
import { Trans } from 'react-i18next'

Expand Down
Loading

0 comments on commit edcaafc

Please sign in to comment.