Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

chore(i18n): clean code

lawvsd6e408a4be71
diff --git a/.github/workflows/languages-sync.yml b/.github/workflows/languages-sync.yml
index 871307ebf4..33b0b79e93 100644
--- a/.github/workflows/languages-sync.yml
+++ b/.github/workflows/languages-sync.yml
@@ -11,6 +11,7 @@ on:
paths:
- 'libs/datasource/i18n/**'
- '.github/workflows/languages-sync.yml'
+ workflow_dispatch:
# Cancels all previous workflow runs for pull requests that have not completed.
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
@@ -49,8 +50,14 @@ jobs:
- name: Check Language Key
if: github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/master'
- run: pnpm run --recursive sync-languages:check
+ working-directory: ./libs/datasource/i18n
+ run: pnpm run sync-languages:check
+ env:
+ TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}
- name: Sync Languages
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
- run: pnpm run --recursive sync-languages
+ working-directory: ./libs/datasource/i18n
+ run: pnpm run sync-languages
+ env:
+ TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}
diff --git a/libs/datasource/i18n/package.json b/libs/datasource/i18n/package.json
index cabc0a36b6..eb1657865e 100644
--- a/libs/datasource/i18n/package.json
+++ b/libs/datasource/i18n/package.json
@@ -7,7 +7,6 @@
},
"dependencies": {
"i18next": "^21.9.1",
- "jotai": "^1.8.1",
"react-i18next": "^11.18.4"
}
}
diff --git a/libs/datasource/i18n/src/scripts/request.ts b/libs/datasource/i18n/src/scripts/request.ts
index 3368feb634..c016909a24 100644
--- a/libs/datasource/i18n/src/scripts/request.ts
+++ b/libs/datasource/i18n/src/scripts/request.ts
@@ -9,6 +9,7 @@ if (!TOLGEE_API_KEY) {
const withTolgee = (
fetch: typeof globalThis.fetch
): typeof globalThis.fetch => {
+ const baseUrl = `${TOLGEE_API_URL}/v2/projects`;
const headers = new Headers({
'X-API-Key': TOLGEE_API_KEY,
'Content-Type': 'application/json',
@@ -29,14 +30,14 @@ const withTolgee = (
if (!argArray[0].headers) {
argArray[0] = {
...argArray[0],
- url: `${TOLGEE_API_URL}/v2/projects${argArray[0].url}`,
+ url: `${baseUrl}${argArray[0].url}`,
headers,
};
}
} else {
// URL or URLLike + ?RequestInit
if (typeof argArray[0] === 'string') {
- argArray[0] = `${TOLGEE_API_URL}/v2/projects${argArray[0]}`;
+ argArray[0] = `${baseUrl}${argArray[0]}`;
}
if (!argArray[1]) {
argArray[1] = {};
diff --git a/libs/datasource/i18n/src/scripts/sync.ts b/libs/datasource/i18n/src/scripts/sync.ts
index c19da6c4ae..a71a0de61f 100644
--- a/libs/datasource/i18n/src/scripts/sync.ts
+++ b/libs/datasource/i18n/src/scripts/sync.ts
@@ -79,8 +79,7 @@ const differenceObject = (
};
function warnDiff(diff: { add: string[]; remove: string[]; modify: string[] }) {
- if (!diff.add.length) {
- } else {
+ if (diff.add.length) {
console.log('New keys found:', diff.add.join(', '));
//See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message
process.env['CI'] &&
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 52c187aa40..164e93cf73 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -580,11 +580,9 @@ importers:
libs/datasource/i18n:
specifiers:
i18next: ^21.9.1
- jotai: ^1.8.1
react-i18next: ^11.18.4
dependencies:
i18next: 21.9.1
- jotai: 1.8.1
react-i18next: [email protected]
libs/datasource/jwt: