From 32e98f1b3a822a5138ec651e3e8837c41bafa46c Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 15:06:44 +0700 Subject: [PATCH 1/9] Create actions-template-sync --- .github/workflows/actions-template-sync | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/workflows/actions-template-sync diff --git a/.github/workflows/actions-template-sync b/.github/workflows/actions-template-sync new file mode 100644 index 000000000..1e0c6c326 --- /dev/null +++ b/.github/workflows/actions-template-sync @@ -0,0 +1,2 @@ +- name: actions-template-sync + uses: AndreasAugustin/actions-template-sync@v0.8.0 From 22bf2823e845d24c881de3cb40ef378fb18eb454 Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 15:12:03 +0700 Subject: [PATCH 2/9] Update and rename actions-template-sync to sync-from-template --- .github/workflows/actions-template-sync | 2 - .github/workflows/sync-from-template | 116 ++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 2 deletions(-) delete mode 100644 .github/workflows/actions-template-sync create mode 100644 .github/workflows/sync-from-template diff --git a/.github/workflows/actions-template-sync b/.github/workflows/actions-template-sync deleted file mode 100644 index 1e0c6c326..000000000 --- a/.github/workflows/actions-template-sync +++ /dev/null @@ -1,2 +0,0 @@ -- name: actions-template-sync - uses: AndreasAugustin/actions-template-sync@v0.8.0 diff --git a/.github/workflows/sync-from-template b/.github/workflows/sync-from-template new file mode 100644 index 000000000..dce89e2bb --- /dev/null +++ b/.github/workflows/sync-from-template @@ -0,0 +1,116 @@ +--- +# +# - Run this workflow to pull changes from the template repository. +# +# - Clone this repository. Check out a branch +# - Copy files from the template onto this clone +# - Push the branch to this repository +# - Create a pull request in this repository +# +name: Sync changes from template + +# TODO: +# - Switch to gh. Check https://github.com/cli/cli/issues/297 for updates + +on: + # Run at 0517 UTC each Friday + schedule: + - cron: "17 5 * * 5" + + # Run when this file changes + push: + paths: + - .github/workflows/sync-from-template.yml + + # Run when manually triggered + workflow_dispatch: + +env: + BASE_BRANCH: main + HEAD_BRANCH: chore/sync-from-template + GIT_AUTHOR_NAME: ${{ github.repository_owner }} + GIT_AUTHOR_EMAIL: ${{ github.repository_owner }}@users.noreply.github.com + REPO_TEMPLATE: chhinsras/soybean-admin + THIS_REPO: ${{ github.repository }} + +jobs: + sync-from-template: + # Do not run on the template repository itself + if: github.repository != 'chhinsras/soybean-admin' + name: Sync changes from chhinsras/soybean-admin + runs-on: ubuntu-latest + continue-on-error: true + + steps: + # Clone the template repository + - name: Check out template repository + uses: actions/checkout@v2 + with: + repository: ${{ env.REPO_TEMPLATE }} + token: ${{ github.token }} + path: ${{ env.REPO_TEMPLATE }} + + # Clone the target repository. Check out a branch + - name: Check out ${{ github.repository }} + uses: actions/checkout@v2 + with: + repository: ${{ github.repository }} + token: ${{ github.token }} + path: ${{ github.repository }} + - name: Create branch in ${{ env.THIS_REPO }} + run: | + git -C "${THIS_REPO}" fetch origin "${HEAD_BRANCH}" || true + git -C "${THIS_REPO}" branch -a + git -C "${THIS_REPO}" checkout -B "${HEAD_BRANCH}" \ + "remotes/origin/${HEAD_BRANCH}" || \ + git -C "${THIS_REPO}" checkout -b "${HEAD_BRANCH}" + + # Copy files from the template onto the target clone + - name: Copy template contents + run: | + _files="$(find ${REPO_TEMPLATE} \ + ! -path "*/.git/*" \ + ! -path "*/.github/workflows/*" \ + ! -name ".gitignore" \ + ! -name "README.md" \ + -type f \ + -print)" + for _file in ${_files}; do + _src="${_file}" + _dst="${THIS_REPO}/${_file#${REPO_TEMPLATE}/}" + # TODO: Find a more robust / elegant way to get this :point_down: + _dst="${_dst%/*}/" + mkdir -p "${_dst}" + echo "INFO: Copy '${_src}' to '${_dst}'." + cp "${_src}" "${_dst}" + done + git -C "${THIS_REPO}" diff + + # Commit changes, if there are any + - name: Commit changes, if any + run: | + git -C ${THIS_REPO} config user.name "${GIT_AUTHOR_NAME}" + git -C ${THIS_REPO} config \ + user.email "${GIT_AUTHOR_EMAIL}" + git -C ${THIS_REPO} add . + git -C ${THIS_REPO} commit \ + -m "Sync from template@${{ github.sha }}" + + # Push the branch to the target repository + - name: Push topic branch + run: git -C ${THIS_REPO} push -u origin "${HEAD_BRANCH}" + + # Create a pull request in the target repository + - name: Create pull request + env: + GITHUB_TOKEN: ${{ github.token }} + GITHUB_USER: ${{ github.actor }} + run: | + pushd ${THIS_REPO} + hub pull-request \ + -b "${BASE_BRANCH}" \ + -h "${HEAD_BRANCH}" \ + --no-edit \ + -m "Pull updates from ${REPO_TEMPLATE}" \ + -m "Pull updates from ${REPO_TEMPLATE}" + popd From ca1e66be47e5ec788caa1191472194ac12bd1f49 Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 15:13:58 +0700 Subject: [PATCH 3/9] Rename sync-from-template to sync-from-template.yml --- .github/workflows/{sync-from-template => sync-from-template.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{sync-from-template => sync-from-template.yml} (100%) diff --git a/.github/workflows/sync-from-template b/.github/workflows/sync-from-template.yml similarity index 100% rename from .github/workflows/sync-from-template rename to .github/workflows/sync-from-template.yml From 1698b21d7a0e3325500efdf36b494d615de91930 Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 15:18:35 +0700 Subject: [PATCH 4/9] Create Sras.md --- Sras.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Sras.md diff --git a/Sras.md b/Sras.md new file mode 100644 index 000000000..345e6aef7 --- /dev/null +++ b/Sras.md @@ -0,0 +1 @@ +Test From 215c1ecbd983688664cd3211f72db230523934ba Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 15:24:51 +0700 Subject: [PATCH 5/9] Update and rename sync-from-template.yml to actions-template-sync.yml --- .github/workflows/actions-template-sync.yml | 25 +++++ .github/workflows/sync-from-template.yml | 116 -------------------- 2 files changed, 25 insertions(+), 116 deletions(-) create mode 100644 .github/workflows/actions-template-sync.yml delete mode 100644 .github/workflows/sync-from-template.yml diff --git a/.github/workflows/actions-template-sync.yml b/.github/workflows/actions-template-sync.yml new file mode 100644 index 000000000..c693a6f2d --- /dev/null +++ b/.github/workflows/actions-template-sync.yml @@ -0,0 +1,25 @@ +name: actions-template-sync + +on: + # cronjob trigger At 00:00 on day-of-month 1. https://crontab.guru/every-month + schedule: + - cron: "0 0 1 * *" + # manual trigger + workflow_dispatch: + +jobs: + test-implementation-job: + + runs-on: ubuntu-latest + + steps: + # To use this repository's private action, you must check out the repository + - + name: Checkout + uses: actions/checkout@v3 + - + name: Test action step PAT + uses: AndreasAugustin/actions-template-sync@v0.8.0 + with: + github_token: ${{ secrets.SOURCE_REPO_PAT }} + source_repo_path: ${{ secrets.SOURCE_REPO_PATH }} # , should be within secrets diff --git a/.github/workflows/sync-from-template.yml b/.github/workflows/sync-from-template.yml deleted file mode 100644 index dce89e2bb..000000000 --- a/.github/workflows/sync-from-template.yml +++ /dev/null @@ -1,116 +0,0 @@ ---- -# -# - Run this workflow to pull changes from the template repository. -# -# - Clone this repository. Check out a branch -# - Copy files from the template onto this clone -# - Push the branch to this repository -# - Create a pull request in this repository -# -name: Sync changes from template - -# TODO: -# - Switch to gh. Check https://github.com/cli/cli/issues/297 for updates - -on: - # Run at 0517 UTC each Friday - schedule: - - cron: "17 5 * * 5" - - # Run when this file changes - push: - paths: - - .github/workflows/sync-from-template.yml - - # Run when manually triggered - workflow_dispatch: - -env: - BASE_BRANCH: main - HEAD_BRANCH: chore/sync-from-template - GIT_AUTHOR_NAME: ${{ github.repository_owner }} - GIT_AUTHOR_EMAIL: ${{ github.repository_owner }}@users.noreply.github.com - REPO_TEMPLATE: chhinsras/soybean-admin - THIS_REPO: ${{ github.repository }} - -jobs: - sync-from-template: - # Do not run on the template repository itself - if: github.repository != 'chhinsras/soybean-admin' - name: Sync changes from chhinsras/soybean-admin - runs-on: ubuntu-latest - continue-on-error: true - - steps: - # Clone the template repository - - name: Check out template repository - uses: actions/checkout@v2 - with: - repository: ${{ env.REPO_TEMPLATE }} - token: ${{ github.token }} - path: ${{ env.REPO_TEMPLATE }} - - # Clone the target repository. Check out a branch - - name: Check out ${{ github.repository }} - uses: actions/checkout@v2 - with: - repository: ${{ github.repository }} - token: ${{ github.token }} - path: ${{ github.repository }} - - name: Create branch in ${{ env.THIS_REPO }} - run: | - git -C "${THIS_REPO}" fetch origin "${HEAD_BRANCH}" || true - git -C "${THIS_REPO}" branch -a - git -C "${THIS_REPO}" checkout -B "${HEAD_BRANCH}" \ - "remotes/origin/${HEAD_BRANCH}" || \ - git -C "${THIS_REPO}" checkout -b "${HEAD_BRANCH}" - - # Copy files from the template onto the target clone - - name: Copy template contents - run: | - _files="$(find ${REPO_TEMPLATE} \ - ! -path "*/.git/*" \ - ! -path "*/.github/workflows/*" \ - ! -name ".gitignore" \ - ! -name "README.md" \ - -type f \ - -print)" - for _file in ${_files}; do - _src="${_file}" - _dst="${THIS_REPO}/${_file#${REPO_TEMPLATE}/}" - # TODO: Find a more robust / elegant way to get this :point_down: - _dst="${_dst%/*}/" - mkdir -p "${_dst}" - echo "INFO: Copy '${_src}' to '${_dst}'." - cp "${_src}" "${_dst}" - done - git -C "${THIS_REPO}" diff - - # Commit changes, if there are any - - name: Commit changes, if any - run: | - git -C ${THIS_REPO} config user.name "${GIT_AUTHOR_NAME}" - git -C ${THIS_REPO} config \ - user.email "${GIT_AUTHOR_EMAIL}" - git -C ${THIS_REPO} add . - git -C ${THIS_REPO} commit \ - -m "Sync from template@${{ github.sha }}" - - # Push the branch to the target repository - - name: Push topic branch - run: git -C ${THIS_REPO} push -u origin "${HEAD_BRANCH}" - - # Create a pull request in the target repository - - name: Create pull request - env: - GITHUB_TOKEN: ${{ github.token }} - GITHUB_USER: ${{ github.actor }} - run: | - pushd ${THIS_REPO} - hub pull-request \ - -b "${BASE_BRANCH}" \ - -h "${HEAD_BRANCH}" \ - --no-edit \ - -m "Pull updates from ${REPO_TEMPLATE}" \ - -m "Pull updates from ${REPO_TEMPLATE}" - popd From 35276bfe41fe6bb690175119953eaf8b50ee1cd6 Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 15:30:10 +0700 Subject: [PATCH 6/9] Update and rename .github/workflows/actions-template-sync.yml to actions-template-sync.yml --- .github/workflows/actions-template-sync.yml | 25 --------------------- actions-template-sync.yml | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/actions-template-sync.yml create mode 100644 actions-template-sync.yml diff --git a/.github/workflows/actions-template-sync.yml b/.github/workflows/actions-template-sync.yml deleted file mode 100644 index c693a6f2d..000000000 --- a/.github/workflows/actions-template-sync.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: actions-template-sync - -on: - # cronjob trigger At 00:00 on day-of-month 1. https://crontab.guru/every-month - schedule: - - cron: "0 0 1 * *" - # manual trigger - workflow_dispatch: - -jobs: - test-implementation-job: - - runs-on: ubuntu-latest - - steps: - # To use this repository's private action, you must check out the repository - - - name: Checkout - uses: actions/checkout@v3 - - - name: Test action step PAT - uses: AndreasAugustin/actions-template-sync@v0.8.0 - with: - github_token: ${{ secrets.SOURCE_REPO_PAT }} - source_repo_path: ${{ secrets.SOURCE_REPO_PATH }} # , should be within secrets diff --git a/actions-template-sync.yml b/actions-template-sync.yml new file mode 100644 index 000000000..59b4ed607 --- /dev/null +++ b/actions-template-sync.yml @@ -0,0 +1,23 @@ +# File: .github/workflows/template-sync.yml + +on: + # cronjob trigger + schedule: + - cron: "0 0 1 * *" + # manual trigger + workflow_dispatch: +jobs: + repo-sync: + runs-on: ubuntu-latest + + steps: + # To use this repository's private action, you must check out the repository + - name: Checkout + uses: actions/checkout@v3 + - name: actions-template-sync + uses: AndreasAugustin/actions-template-sync@v0.8.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + source_repo_path: 'chhinsras/soybean-admin' + upstream_branch: 'main' # defaults to main + pr_labels: ,[,...] # optional, no default From 3b5380e0d134a458f3c584d735c275e974a443ff Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 15:38:43 +0700 Subject: [PATCH 7/9] Update Sras.md --- Sras.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sras.md b/Sras.md index 345e6aef7..75c52f288 100644 --- a/Sras.md +++ b/Sras.md @@ -1 +1 @@ -Test +Test Sync From a0da2f6e1672d29a9fc86f3d8a72e4f7f1789329 Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 15:52:05 +0700 Subject: [PATCH 8/9] Delete actions-template-sync.yml --- actions-template-sync.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 actions-template-sync.yml diff --git a/actions-template-sync.yml b/actions-template-sync.yml deleted file mode 100644 index 59b4ed607..000000000 --- a/actions-template-sync.yml +++ /dev/null @@ -1,23 +0,0 @@ -# File: .github/workflows/template-sync.yml - -on: - # cronjob trigger - schedule: - - cron: "0 0 1 * *" - # manual trigger - workflow_dispatch: -jobs: - repo-sync: - runs-on: ubuntu-latest - - steps: - # To use this repository's private action, you must check out the repository - - name: Checkout - uses: actions/checkout@v3 - - name: actions-template-sync - uses: AndreasAugustin/actions-template-sync@v0.8.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - source_repo_path: 'chhinsras/soybean-admin' - upstream_branch: 'main' # defaults to main - pr_labels: ,[,...] # optional, no default From f89f3e6a3854c4581fcac79ba4709664506e2ab0 Mon Sep 17 00:00:00 2001 From: Chhin Sras <31751665+chhinsras@users.noreply.github.com> Date: Wed, 24 May 2023 21:07:35 +0700 Subject: [PATCH 9/9] Added Khmer Translation --- .../global-header/components/toggle-lang.vue | 6 +- src/locales/lang/index.ts | 4 +- src/locales/lang/km-KH.ts | 85 +++++++++++++++++++ src/typings/system.d.ts | 2 +- 4 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 src/locales/lang/km-KH.ts diff --git a/src/layouts/common/global-header/components/toggle-lang.vue b/src/layouts/common/global-header/components/toggle-lang.vue index d5e8e2f9e..75ee178f4 100644 --- a/src/layouts/common/global-header/components/toggle-lang.vue +++ b/src/layouts/common/global-header/components/toggle-lang.vue @@ -22,7 +22,11 @@ const options = [ { label: 'English', key: 'en' - } + }, + { + label: 'ភាសាខ្មែរ', + key: 'km-KH' + } ]; const handleSelect = (key: string) => { language.value = key as I18nType.langType; diff --git a/src/locales/lang/index.ts b/src/locales/lang/index.ts index baf3eb71b..5d8882a42 100644 --- a/src/locales/lang/index.ts +++ b/src/locales/lang/index.ts @@ -1,9 +1,11 @@ import zhCN from './zh-cn'; import en from './en'; +import kmKH from './km-KH'; const locales = { 'zh-CN': zhCN, - en + en, + 'km-KH': kmKH, }; export type LocaleKey = keyof typeof locales; diff --git a/src/locales/lang/km-KH.ts b/src/locales/lang/km-KH.ts new file mode 100644 index 000000000..f6ebf661c --- /dev/null +++ b/src/locales/lang/km-KH.ts @@ -0,0 +1,85 @@ +import type { LocaleMessages } from 'vue-i18n'; + +const locale: LocaleMessages = { + message: { + system: { + title: 'ប្រព័ន្ធគ្រប់គ្រង' + }, + routes: { + dashboard: { + dashboard: 'ផ្ទាំងទិន្នន័យ', + analysis: 'ផ្ទាំងវិភាគ', + workbench: 'ផ្ទាំងការងារ' + }, + document: { + _value: 'ឯកសារ', + vue: 'ឯកសារ​ Vue', + vite: 'ឯកសារ​ Vite', + naive: 'ឯកសារ NaiveUI', + project: 'ឯកសារគម្រោង', + 'project-link': 'ឯកសារគម្រោង(href)' + }, + component: { + _value: 'សមាស​ភាគ', + button: 'ប៊ូតុង', + card: 'កាត', + table: 'តារាង' + }, + plugin: { + _value: 'មុខងារជំនួយ', + charts: { + _value: 'តារាង​ Chart', + echarts: 'តារាង ECharts', + antv: 'AntV' + }, + copy: 'ចម្លង', + editor: { + _value: 'កែប្រែ', + quill: 'Quill', + markdown: 'Markdown' + }, + icon: 'អាយខន', + map: 'ផែនទី', + print: 'បោះពុម្ភ', + swiper: 'Swiper', + video: 'វីដេអូ' + }, + 'auth-demo': { + _value: 'ឌីមូ Auth', + permission: 'បិទ/បើកការអនុញ្ញាត', + super: 'Super Auth' + }, + function: { + _value: 'មុខងារ', + tab: 'ថេបប្រព័ន្ធ' + }, + exception: { + _value: 'ករណីពិេសស', + 403: '403', + 404: '404', + 500: '500' + }, + 'multi-menu': { + _value: 'ម៉ឺនុយពហុដឺក្រេ', + first: { + _value: 'ដឺក្រេទី១', + second: 'ដែក្រេទី២', + 'second-new': { + _value: 'ដឺក្រេទី២មានអនុក្រោម', + third: 'ដឺក្រេទី៣' + } + } + }, + management: { + _value: 'ការគ្រប់គ្រងប្រព័ន្ធ', + auth: 'Auth', + role: 'សិទ្ធី', + route: 'ផ្លូវប្រព័ន្ធ', + user: 'អ្នកប្រើប្រាស់' + }, + about: 'អំពីប្រព័ន្ធ' + } + } +}; + +export default locale; diff --git a/src/typings/system.d.ts b/src/typings/system.d.ts index 949f82ef8..153ae90eb 100644 --- a/src/typings/system.d.ts +++ b/src/typings/system.d.ts @@ -302,7 +302,7 @@ declare namespace App { } declare namespace I18nType { - type langType = 'en' | 'zh-CN'; + type langType = 'en' | 'zh-CN' | 'km-KH'; interface Schema { system: {