Skip to content

Commit 2921bad

Browse files
Add po4a for ru translate (#246)
Co-authored-by: ArduanovDanil <[email protected]>
1 parent 37d36e3 commit 2921bad

File tree

112 files changed

+28189
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+28189
-137
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: errata-ai/vale-action@reviewdog
1818
with:
1919
reporter: github-check
20-
fail_on_error: true
20+
fail_on_error: false
2121
filter_mode: nofilter
2222
files: '["cookbook", "guide"]'
2323
env:

.github/workflows/translation.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update docs translation
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'cookbook/**'
7+
- 'guide/**'
8+
9+
jobs:
10+
update-docs:
11+
name: Update docs
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.YIISOFT_GITHUB_TOKEN || github.token }}
18+
ref: ${{ github.head_ref }}
19+
repository: ${{ github.event.pull_request.head.repo.full_name }}
20+
21+
- name: Use po4a
22+
uses: addnab/docker-run-action@v3
23+
with:
24+
image: arduanovdanil/po4a-fork:v0.73
25+
options: -v ${{ github.workspace }}:/src
26+
run: |
27+
cd guide
28+
po4a po4a.cfg
29+
30+
- name: Commit changed files
31+
uses: stefanzweifel/git-auto-commit-action@v5
32+
with:
33+
commit_message: Update translation
34+
file_pattern: 'guide'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ Thumbs.db
1414

1515
# Mac DS_Store Files
1616
.DS_Store
17+
18+
# po4a .mo files
19+
*.mo

014-docs.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ focused on a single package but is covering certain use-cases.
2323

2424
The guide should follow [Micosoft style guide](https://learn.microsoft.com/en-us/style-guide/welcome/).
2525

26+
### Translation
27+
28+
The definitive guide uses [po4a](https://github.com/mquinson/po4a) in Github Action for translations.
29+
Translation algorithm:
30+
- Install an application for working with `.po` translation files. For example, [Poedit](https://poedit.net/), [Lokalize](https://apps.kde.org/ru/lokalize/), [Gtranslator](https://wiki.gnome.org/Apps/Gtranslator) or another.
31+
- Find folder with the name of the file you want to translate in `/guide/po`. Note that if the source file is in a subfolder, the subfolder name is appended to the folder and separated by an underscore, for example: for translating `guide/en/concept/aliases.md` file find `guide/po/concept_aliases.md` folder.
32+
- Open the file with the `.po` extension in `Poedit` from the folder with the desired localization, for example `guide/po/intro_what-is-yii.md/ru/intro_what-is-yii.md.ru.po`. If there is no localization yet, create an issue.
33+
- Translate necessary strings and push the changes
34+
- Open pull request to main repository
35+
36+
> [!CAUTION]
37+
> Do not change the translation in files in `/guide/{lang}` manually.
38+
39+
If you have changed English documentation:
40+
- Open pull request to main repository
41+
- Pull updated branch after successful completion of workflow `Update docs translation` in Github Action
42+
- Update translation in `.po` files by `Poedit`
43+
- Push changes
44+
2645
## Blocks
2746

2847
Blocks are in the [GitHub Alerts format](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts):

0 commit comments

Comments
 (0)