Skip to content

Commit 54bff4f

Browse files
authored
Merge branch 'tarantool:master' into abelyaev/sql_statements
2 parents bc10307 + 79fc7bb commit 54bff4f

File tree

12 files changed

+1306
-0
lines changed

12 files changed

+1306
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Destroy-deployments
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'doc/**/*'
7+
types:
8+
- closed
9+
jobs:
10+
destroy-deployment:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
token: "${{ secrets.GITHUB_TOKEN }}"
16+
17+
- name: Set branch name from source branch
18+
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
19+
20+
- name: Remove dev server deployment at ${{env.DEPLOYMENT_NAME}}
21+
uses: strumwolf/delete-deployment-environment@v2
22+
with:
23+
token: "${{ secrets.TARANTOOLBOT_TOKEN }}"
24+
environment: "translation-${{env.BRANCH_NAME}}"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Pull translations
2+
3+
on:
4+
workflow_dispatch:
5+
branches:
6+
- '!master'
7+
jobs:
8+
pull-translations:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
token: ${{secrets.TARANTOOLBOT_TOKEN}}
15+
16+
- name: Set branch name from source branch
17+
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
18+
19+
- name: Setup Python environment
20+
uses: actions/setup-python@v2
21+
22+
- name: Setup Python requirements
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install -r doc/requirements.txt
26+
27+
- name: Pull translations from Crowdin
28+
uses: crowdin/[email protected]
29+
with:
30+
config: 'doc/crowdin.yaml'
31+
upload_sources: false
32+
upload_translations: false
33+
push_translations: false
34+
download_translations: true
35+
download_language: 'ru'
36+
crowdin_branch_name: ${{env.BRANCH_NAME}}
37+
debug_mode: true
38+
env:
39+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
40+
CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}}
41+
42+
- name: Cleanup translation files
43+
run: |
44+
sudo chown -R runner:docker doc/locale/ru/LC_MESSAGES
45+
python doc/cleanup.py po
46+
47+
- name: Commit translation files
48+
uses: stefanzweifel/[email protected]
49+
with:
50+
commit_message: "Update translations"
51+
file_pattern: "*.po"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Push translation sources
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'doc/**/*'
7+
jobs:
8+
push-translation-sources:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Set branch name from source branch
15+
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
16+
17+
- name: Start translation service deployment
18+
uses: bobheadxi/[email protected]
19+
id: translation
20+
with:
21+
step: start
22+
token: ${{secrets.GITHUB_TOKEN}}
23+
env: translation-${{env.BRANCH_NAME}}
24+
ref: ${{github.head_ref}}
25+
26+
- name: Setup Python environment
27+
uses: actions/setup-python@v2
28+
29+
- name: Setup Python requirements
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -r doc/requirements.txt
33+
34+
- name: Build pot files
35+
run: python -m sphinx . doc/locale/en -c doc -b gettext
36+
37+
- name: Push POT files to crowdin
38+
uses: crowdin/[email protected]
39+
with:
40+
upload_sources: true
41+
upload_translations: false
42+
crowdin_branch_name: ${{env.BRANCH_NAME}}
43+
config: 'doc/crowdin.yaml'
44+
env:
45+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
46+
CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}}
47+
48+
- name: update deployment status
49+
uses: bobheadxi/[email protected]
50+
with:
51+
step: finish
52+
token: ${{secrets.GITHUB_TOKEN}}
53+
status: ${{job.status}}
54+
deployment_id: ${{steps.translation.outputs.deployment_id}}
55+
env_url: https://crowdin.com/project/tarantool-cpp/ru#/${{env.BRANCH_NAME}}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Update translations on the main branch
2+
3+
on:
4+
push:
5+
paths:
6+
- 'doc/**/*'
7+
branches:
8+
- master
9+
jobs:
10+
autocommit-pot-files:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Setup Python environment
19+
uses: actions/setup-python@v2
20+
21+
- name: Setup Python requirements
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r doc/requirements.txt
25+
26+
- name: Build pot files
27+
run: python -m sphinx . doc/locale/en -c doc -b gettext
28+
29+
- name: Push Pot-files to crowdin
30+
uses: crowdin/[email protected]
31+
with:
32+
config: 'doc/crowdin.yaml'
33+
upload_sources: true
34+
upload_translations: true
35+
import_eq_suggestions: true
36+
env:
37+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
38+
CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@
2626
*.exe
2727
*.out
2828
*.app
29+
30+
# Documentation builds
31+
doc/locale/en/
32+
doc/output

doc/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[![Crowdin](https://badges.crowdin.net/tarantool-cpp/localized.svg)](https://crowdin.com)
2+
3+
# Tarantool Tarantool C++ Connector documentation
4+
Part of Tarantool documentation, published to
5+
https://www.tarantool.io/en/doc/latest/getting_started/getting_started_cxx/
6+
7+
### Create pot files from rst
8+
```bash
9+
python -m sphinx . doc/locale/en -c doc -b gettext
10+
```
11+
12+
### Create/update po from pot files
13+
```bash
14+
sphinx-intl update -p doc/locale/en -d doc/locale -l ru
15+
```
16+
17+
### Build documentation to doc/output
18+
```bash
19+
python -m sphinx . doc/output -c doc
20+
```

doc/cleanup.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#! /usr/bin/env python3
2+
import argparse
3+
from glob import glob
4+
from polib import pofile, POFile, _BaseFile
5+
6+
parser = argparse.ArgumentParser(description='Cleanup PO and POT files')
7+
parser.add_argument('extension', type=str, choices=['po', 'pot', 'both'],
8+
help='cleanup files with extension: po, pot or both')
9+
10+
11+
class PoFile(POFile):
12+
13+
def __unicode__(self):
14+
return _BaseFile.__unicode__(self)
15+
16+
def metadata_as_entry(self):
17+
class M:
18+
def __unicode__(self, _):
19+
return ''
20+
return M()
21+
22+
23+
def cleanup_files(extension):
24+
mask = f'**/*.{extension}'
25+
for file_path in glob(mask, recursive=True):
26+
print(f'cleanup {file_path}')
27+
po_file: POFile = pofile(file_path, klass=PoFile)
28+
po_file.header = ''
29+
po_file.metadata = {}
30+
po_file.metadata_is_fuzzy = False
31+
32+
for item in po_file:
33+
item.occurrences = None
34+
35+
po_file.save()
36+
37+
38+
if __name__ == "__main__":
39+
40+
args = parser.parse_args()
41+
42+
if args.extension in ['po', 'both']:
43+
cleanup_files('po')
44+
45+
if args.extension in ['pot', 'both']:
46+
cleanup_files('pot')

doc/conf.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys
2+
import os
3+
4+
sys.path.insert(0, os.path.abspath(''))
5+
6+
master_doc = 'doc/tntcxx_getting_started'
7+
8+
source_suffix = '.rst'
9+
10+
project = u'tntcxx'
11+
12+
exclude_patterns = [
13+
'doc/locale',
14+
'doc/output',
15+
'doc/README.md',
16+
'doc/cleanup.py',
17+
'doc/requirements.txt',
18+
]
19+
20+
language = 'en'
21+
locale_dirs = ['./doc/locale']
22+
gettext_compact = False
23+
gettext_location = True

doc/crowdin.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# https://support.crowdin.com/configuration-file/
2+
# https://support.crowdin.com/cli-tool-v3/#configuration
3+
4+
"project_id" : "457586"
5+
"base_path" : "doc/locale"
6+
"base_url": "https://crowdin.com"
7+
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
8+
9+
10+
"preserve_hierarchy": true
11+
12+
files: [
13+
{
14+
"source" : "/en/**/*.pot",
15+
"translation" : "/%locale_with_underscore%/LC_MESSAGES/**/%file_name%.po",
16+
"update_option" : "update_as_unapproved",
17+
18+
"languages_mapping" : {
19+
"locale_with_underscore" : {
20+
"ru" : "ru",
21+
}
22+
},
23+
}
24+
]

0 commit comments

Comments
 (0)