Skip to content

Commit 95278f3

Browse files
committed
Integrate docs to Crowdin
Closes #385
1 parent b23c9e2 commit 95278f3

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Sync translations
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [master]
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
sync-translations:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
24+
- name: Generate JSON source files from Docusaurus config
25+
run: npm ci && npm run write-translations
26+
27+
- name: Sync sources and translations
28+
uses: crowdin/github-action@v2
29+
with:
30+
config: "crowdin.yml"
31+
upload_sources: true
32+
upload_translations: true
33+
download_translations: true
34+
export_only_approved: true
35+
localization_branch_name: l10n_crowdin_translations
36+
create_pull_request: true
37+
pull_request_title: "New Crowdin translations"
38+
pull_request_body: "New translations from Crowdin."
39+
pull_request_base_branch_name: "master"
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
43+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

crowdin.yml

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
#
2+
# Your Crowdin credentials
3+
#
4+
"project_id_env": "CROWDIN_PROJECT_ID"
5+
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
6+
"base_path": "."
7+
"base_url": "https://api.crowdin.com"
8+
9+
#
10+
# Choose file structure in Crowdin
11+
# e.g. true or false
12+
#
13+
"preserve_hierarchy": true
14+
15+
#
16+
# Files configuration
17+
#
18+
files: [
19+
# JSON translation files
20+
{ "source": "/i18n/en/**/*", "translation": "/i18n/%two_letters_code%/**/%original_file_name%" },
21+
# Docs Markdown files
22+
{
23+
"source": "/docs/**/*",
24+
"translation": "/i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%",
25+
},
26+
# {
27+
#
28+
# Source files filter
29+
# e.g. "/resources/en/*.json"
30+
#
31+
32+
#
33+
# Where translations will be placed
34+
# e.g. "/resources/%two_letters_code%/%original_file_name%"
35+
#
36+
37+
#
38+
# Files or directories for ignore
39+
# e.g. ["/**/?.txt", "/**/[0-9].txt", "/**/*\?*.txt"]
40+
#
41+
# "ignore": [],
42+
43+
#
44+
# The dest allows you to specify a file name in Crowdin
45+
# e.g. "/messages.json"
46+
#
47+
# "dest": "",
48+
49+
#
50+
# File type
51+
# e.g. "json"
52+
#
53+
# "type": "",
54+
55+
#
56+
# The parameter "update_option" is optional. If it is not set, after the files update the translations for changed strings will be removed. Use to fix typos and for minor changes in the source strings
57+
# e.g. "update_as_unapproved" or "update_without_changes"
58+
#
59+
# "update_option": "",
60+
61+
#
62+
# Start block (for XML only)
63+
#
64+
65+
#
66+
# Defines whether to translate tags attributes.
67+
# e.g. 0 or 1 (Default is 1)
68+
#
69+
# "translate_attributes": 1,
70+
71+
#
72+
# Defines whether to translate texts placed inside the tags.
73+
# e.g. 0 or 1 (Default is 1)
74+
#
75+
# "translate_content": 1,
76+
77+
#
78+
# This is an array of strings, where each item is the XPaths to DOM element that should be imported
79+
# e.g. ["/content/text", "/content/text[@value]"]
80+
#
81+
# "translatable_elements": [],
82+
83+
#
84+
# Defines whether to split long texts into smaller text segments
85+
# e.g. 0 or 1 (Default is 1)
86+
#
87+
# "content_segmentation": 1,
88+
89+
#
90+
# End block (for XML only)
91+
#
92+
93+
#
94+
# Start .properties block
95+
#
96+
97+
#
98+
# Defines whether single quote should be escaped by another single quote or backslash in exported translations
99+
# e.g. 0 or 1 or 2 or 3 (Default is 3)
100+
# 0 - do not escape single quote;
101+
# 1 - escape single quote by another single quote;
102+
# 2 - escape single quote by backslash;
103+
# 3 - escape single quote by another single quote only in strings containing variables ( {0} ).
104+
#
105+
# "escape_quotes": 3,
106+
107+
#
108+
# Defines whether any special characters (=, :, ! and #) should be escaped by backslash in exported translations.
109+
# e.g. 0 or 1 (Default is 0)
110+
# 0 - do not escape special characters
111+
# 1 - escape special characters by a backslash
112+
#
113+
# "escape_special_characters": 0
114+
#
115+
116+
#
117+
# End .properties block
118+
#
119+
120+
#
121+
# Does the first line contain header?
122+
# e.g. true or false
123+
#
124+
# "first_line_contains_header": true,
125+
126+
#
127+
# for spreadsheets
128+
# e.g. "identifier,source_phrase,context,uk,ru,fr"
129+
#
130+
# "scheme": "",
131+
# }
132+
133+
]

0 commit comments

Comments
 (0)