Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix translation progress badge#318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Dumeng merged 9 commits intopython:masterfromDumeng:master
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions.github/ISSUE_TEMPLATE/translation.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,15 +11,15 @@ body:
id: version
attributes:
label: Python Version
description: Which version of Pythondocs contains the issue?
description: Which version ofthePythondocumentation covers this issue?
placeholder: ex. 3.12
validations:
required: true
- type: input
id: url
attributes:
label: Docs Page
description: What is the url of the pagecontains the issue?
description: What is the url of the pagecontaining the issue?
placeholder: https://docs.python.org/3/about.html
validations:
required: true
Expand All@@ -41,6 +41,6 @@ body:
id: zh-suggested
attributes:
label: Suggested Fix
description: What isyou suggeest fix?
description: What isyour suggested fix?
validations:
required: true
33 changes: 33 additions & 0 deletions.github/scripts/tx_stat.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
import json
import os
import urllib.request
from datetime import datetime

key = os.environ.get('TX_TOKEN')
project = os.environ.get('TX_PROJECT')

url = "https://rest.api.transifex.com/resource_language_stats?filter[project]=o%3Apython-doc%3Ap%3A{}&filter[language]=l%3Azh_CN".format(project)

headers = {
"accept": "application/vnd.api+json",
"authorization": "Bearer " + key
}

total = 0
translated = 0

while(url):
request = urllib.request.Request(url=url,headers=headers)

with urllib.request.urlopen(request) as response:
data = json.loads(response.read().decode("utf-8"))
url = data['links'].get('next')
for resourse in data['data']:
translated = translated + resourse['attributes']['translated_strings']
total = total + resourse['attributes']['total_strings']

p = '{:.2%}'.format(translated/total)
print(json.dumps({
'translation':p,
'updated_at':datetime.utcnow().isoformat(timespec='seconds') + 'Z',
}))
1 change: 1 addition & 0 deletions.github/workflows/python-310.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,5 +12,6 @@ jobs:
uses: ./.github/workflows/sync.yml
with:
version: "3.10"
tx_project: "python-310"
secrets: inherit

1 change: 1 addition & 0 deletions.github/workflows/python-311.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,5 +12,6 @@ jobs:
uses: ./.github/workflows/sync.yml
with:
version: "3.11"
tx_project: "python-311"
secrets: inherit

1 change: 1 addition & 0 deletions.github/workflows/python-312.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,4 +12,5 @@ jobs:
uses: ./.github/workflows/sync.yml
with:
version: "3.12"
tx_project: "python-newest"
secrets: inherit
1 change: 1 addition & 0 deletions.github/workflows/python-38.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,4 +12,5 @@ jobs:
uses: ./.github/workflows/sync.yml
with:
version: "3.8"
tx_project: "python-38"
secrets: inherit
1 change: 1 addition & 0 deletions.github/workflows/python-39.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,5 +12,6 @@ jobs:
uses: ./.github/workflows/sync.yml
with:
version: "3.9"
tx_project: "python-39"
secrets: inherit

8 changes: 8 additions & 0 deletions.github/workflows/sync.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,9 @@ on:
version:
required: true
type: string
tx_project:
required: true
type: string
secrets:
TRANSIFEX_APIKEY:
required: true
Expand DownExpand Up@@ -37,5 +40,10 @@ jobs:
TX_TOKEN: ${{ secrets.TRANSIFEX_APIKEY }}
- name: build
run: .github/scripts/build.sh
- name: stat
run: python .github/scripts/tx_stat.py > ./docs/.stat.json
env:
TX_TOKEN: ${{ secrets.TRANSIFEX_APIKEY }}
TX_PROJECT: ${{ inputs.tx_project }}
- name: commit
run: .github/scripts/commit.sh
12 changes: 6 additions & 6 deletionsREADME.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,27 +15,27 @@ Maintained versions:
* - `3.12 <https://github.com/python/python-docs-zh-cn/tree/3.12>`_
- .. image:: https://github.com/python/python-docs-zh-cn/workflows/python-312/badge.svg
:target: https://github.com/python/python-docs-zh-cn/actions?workflow=python-312
- .. image:: https://img.shields.io/badge/dynamic/json.svg?label=zh_CN&query=%24.zh_CN&url=http://gce.zhsj.me/python/312
- .. image:: https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fpython%2Fpython-docs-zh-cn%2F3.12%2F.stat.json&query=%24.translation&label=zh-CN
:target: https://app.transifex.com/python-doc/python-newest/
* - `3.11 <https://github.com/python/python-docs-zh-cn/tree/3.11>`_
- .. image:: https://github.com/python/python-docs-zh-cn/workflows/python-311/badge.svg
:target: https://github.com/python/python-docs-zh-cn/actions?workflow=python-311
- .. image:: https://img.shields.io/badge/dynamic/json.svg?label=zh_CN&query=%24.zh_CN&url=http://gce.zhsj.me/python/311
- .. image:: https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fpython%2Fpython-docs-zh-cn%2F3.11%2F.stat.json&query=%24.translation&label=zh-CN
:target: https://app.transifex.com/python-doc/python-311/
* - `3.10 <https://github.com/python/python-docs-zh-cn/tree/3.10>`_
- .. image:: https://github.com/python/python-docs-zh-cn/workflows/python-310/badge.svg
:target: https://github.com/python/python-docs-zh-cn/actions?workflow=python-310
- .. image:: https://img.shields.io/badge/dynamic/json.svg?label=zh_CN&query=%24.zh_CN&url=http://gce.zhsj.me/python/310
- .. image:: https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fpython%2Fpython-docs-zh-cn%2F3.10%2F.stat.json&query=%24.translation&label=zh-CN
:target: https://app.transifex.com/python-doc/python-310/
* - `3.9 <https://github.com/python/python-docs-zh-cn/tree/3.9>`_
- .. image:: https://github.com/python/python-docs-zh-cn/workflows/python-39/badge.svg
:target: https://github.com/python/python-docs-zh-cn/actions?workflow=python-39
- .. image:: https://img.shields.io/badge/dynamic/json.svg?label=zh_CN&query=%24.zh_CN&url=http://gce.zhsj.me/python/39
- .. image:: https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fpython%2Fpython-docs-zh-cn%2F3.9%2F.stat.json&query=%24.translation&label=zh-CN
:target: https://app.transifex.com/python-doc/python-39/
* - `3.8 <https://github.com/python/python-docs-zh-cn/tree/3.8>`_
- .. image:: https://github.com/python/python-docs-zh-cn/workflows/python-38/badge.svg
:target: https://github.com/python/python-docs-zh-cn/actions?workflow=python-38
- .. image:: https://img.shields.io/badge/dynamic/json.svg?label=zh_CN&query=%24.zh_CN&url=http://gce.zhsj.me/python/38
- .. image:: https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fpython%2Fpython-docs-zh-cn%2F3.8%2F.stat.json&query=%24.translation&label=zh-CN
:target: https://app.transifex.com/python-doc/python-38/

EOL versions:
Expand All@@ -49,7 +49,7 @@ EOL versions:
* - `3.7 <https://github.com/python/python-docs-zh-cn/tree/3.7>`_
- .. image:: https://github.com/python/python-docs-zh-cn/workflows/python-37/badge.svg
:target: https://github.com/python/python-docs-zh-cn/actions?workflow=python-37
- .. image:: https://img.shields.io/badge/dynamic/json.svg?label=zh_CN&query=%24.zh_CN&url=http://gce.zhsj.me/python/37
- .. image:: https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fpython%2Fpython-docs-zh-cn%2F3.7%2F.stat.json&query=%24.translation&label=zh-CN
:target: https://app.transifex.com/python-doc/python-37/

Documentation Contribution Agreement
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp