Skip to content

Commit

Permalink
i18n to translate
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaofeng1227 committed Nov 28, 2023
1 parent a92bc49 commit b8335a6
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 206 deletions.
56 changes: 51 additions & 5 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,68 @@ on:
push:
branches: [ main ]
paths:
- 'i18n/itemname_fields'
- "apps/*/.env"

jobs:
build:
create:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@master
name: Check out code
- name: Create tranlation files

- name: Get changed apps list and Update translation.json
run: |
echo "Get list"
changefile=$(curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{github.token}}" \
https://api.github.com/repos/Websoft9/docker-library/compare/${{github.event.before}}...${{github.event.after}} | jq '.files[].filename' | sed 's/\"//g')
declare -a appnames
for name in ${changefile};do
echo ${name}
app=$(echo ${name} | cut -d "/" -f 2)
file=$(echo ${name} | cut -d "/" -f 3)
if [[ ${file} == ".env" ]];then
if [[ ! " ${appnames[@]} " =~ " ${app} " ]]; then
appnames+=(${app})
fi
else
echo "affect nothing";
fi
done
echo "start to update translation.json"
cd i18n
python3 build.py
python3 create.py appnames
- name: push i18n
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: push i18n
push_options: --force

pr:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout websoft9
uses: actions/checkout@v2
with:
repository: Websoft9/plugin-appstore
ref: main

- name: update languages files
run: |
wget https://raw.githubusercontent.com/Websoft9/docker-library/main/i18n/translation.json
wget ttps://raw.githubusercontent.com/Websoft9/docker-library/main/i18n/pr.py
python3 pr.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.ZJ_ADMIN_TOKEN }}
branch: update-appstore-version-${{ github.run_number }}
delete-branch: true
commit-message: App Store conbine translation.json
title: "App Store conbine translation.json: ${{ steps.update_data.outputs.PLUGIN_VERSION }}"
body: "App Store conbine translation.json"
30 changes: 0 additions & 30 deletions i18n/build.py

This file was deleted.

6 changes: 6 additions & 0 deletions i18n/create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import json
import os

# 从目录应用中获取W9_*_SET,合并去重成为新的 envs 数组

# 将 envs 数组以增量的方式合并到 translation.json
25 changes: 0 additions & 25 deletions i18n/itemname_fields

This file was deleted.

6 changes: 6 additions & 0 deletions i18n/pr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import json
import os

# translation.json 以增量的方式合并到 po.json
# https://github.com/Websoft9/plugin-appstore/blob/main/public/po.zh_CN.js
# https://github.com/Websoft9/plugin-appstore/blob/main/public/po.en_US.js
18 changes: 18 additions & 0 deletions i18n/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"W9_DB_PORT_SET": [
"Database Port",
"应用数据库端口"
],
"W9_HTTP_PORT_SET": [
"App HTTP Port",
"应用 HTTP 端口"
],
"W9_AGENT_PORT_SET": [
"Application Agent Port",
"应用代理端口"
],
"W9_SSH_PORT_SET": [
"Application SSH Port",
"应用 SSH 端口"
]
}
25 changes: 0 additions & 25 deletions i18n/translation_de.json

This file was deleted.

24 changes: 0 additions & 24 deletions i18n/translation_en.json

This file was deleted.

23 changes: 0 additions & 23 deletions i18n/translation_es.json

This file was deleted.

25 changes: 0 additions & 25 deletions i18n/translation_fr.json

This file was deleted.

25 changes: 0 additions & 25 deletions i18n/translation_ja.json

This file was deleted.

24 changes: 0 additions & 24 deletions i18n/translation_zh.json

This file was deleted.

0 comments on commit b8335a6

Please sign in to comment.