You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update README to reflect sync_localization lane and workflow update
* Use same Buildkite annotation context on sync_localization lane
* Add documentation about new localization PRs replacing the previous ones
Co-authored-by: Olivier Halligon <[email protected]>
* Expand documentation on automatic PO file upload
Co-authored-by: Olivier Halligon <[email protected]>
* Remove redundant description of automation steps
* Add Mermaid graph of the localization workflow
* Update README to clarify behavior when there's a previous localization PR
Co-authored-by: Olivier Halligon <[email protected]>
* Add descriptive info linked to the Mermaid chart
* Change order to group workflow description sections
---------
Co-authored-by: Olivier Halligon <[email protected]>
Copy file name to clipboardExpand all lines: wp_localization/README.md
+83-9Lines changed: 83 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,25 +15,94 @@ _Note that we have to commit the `glotpress/en-US.pot` file here because that fi
15
15
16
16
## Workflow for Developers
17
17
18
-
### Automated Daily Sync
18
+
### Automated Nightly Sync
19
19
20
20
The localization process runs automatically every night via a Buildkite pipeline (`.buildkite/nightly.yml`). This automated job:
21
21
22
22
1.**Generates the source en-US PO file** from `localization/en-US/main.ftl` and commits it to `glotpress/en-US.pot`
23
23
2.**Downloads latest translations** from GlotPress for all supported locales as PO files
24
24
3.**Converts downloaded PO files to Fluent format** and updates the corresponding `localization/*/main.ftl` files
25
-
4.**Commits the updated translation files** to the repository
25
+
4.**Creates a Pull Request** targeting `trunk` with the updated translation files and the updated original en-US PO file in the repository.
26
+
- If a previous localization sync Pull Request was still open at the time the nightly sync happens, that previous Pull Request will be closed and a new one will be opened with the latest translations to take its place.
27
+
28
+
Once you merge the Pull Request into `trunk`, the updated `glotpress/en-US.pot` file will be picked up by a wpcom job to import it into GlotPress, so that translators can start working on the new strings.
26
29
27
30
This means that translation updates happen automatically without developer intervention.
28
31
29
32
### Adding New Localization Strings
30
33
31
-
1.**Add strings to the source file**: Edit `wp_localization/localization/en-US/main.ftl` to add or update localization strings.
32
-
33
-
2.**The automated nightly job will handle the rest**: The next nightly run will automatically:
34
-
- Convert your changes to PO format (`glotpress/en-US.pot`)
35
-
- Commit the updated source file
36
-
- Upload to GlotPress via the wpcom cron job
34
+
To add or update new localizable strings to the project, just edit `wp_localization/localization/en-US/main.ftl` to add or update them, using the English copy.
35
+
36
+
[The "Automated Nightly Sync" described above](#automated-nightly-sync) will take care of the rest. In particular:
37
+
38
+
* Once your `en-US/main.ftl` file has landed into `trunk`, it will be read by the "Automated Nightly Sync" job on its next run (2), to generate a `en-US.pot` file (which will later be imported in GlotPress (6 & 7))
39
+
* That automation will also use the occasion to download latest translations from GlotPress (3), then create a Pull Request (4) containing both this generated `en-US.pot` from (2) and the new `*/main.ftl` translations from (3)
40
+
* After you merge that Pull Request (5), the wpcom job will be able to later import the `en-US.pot` file with the latest originals to GlotPress (6 & 7)
41
+
* Note that you'll only get the translations from the new string after 2 cycles of the Automated Nightly Sync: the first one (2–7) will ensure the new strings you added in (1) will make its way to GlotPress for translators to start working on it, while the 2nd run (9–14) will bring those translations from GlotPress to trunk after the translators had time to work on them.
42
+
43
+
## Localization Process Flow
44
+
45
+
Here's a visual representation of the typical localization workflow:
46
+
47
+
```mermaid
48
+
sequenceDiagram
49
+
autonumber
50
+
actor Dev
51
+
participant Git
52
+
participant ANS as Automated Nightly Sync<br/>(Buildkite Job)
53
+
participant GlotPress
54
+
participant wpcom as wpcom cron job
55
+
56
+
Dev->>Git: Add new string "A" to `en-US/main.ftl` and commit to trunk
57
+
58
+
loop Nightly Sync (Run 1)
59
+
activate ANS
60
+
Git-->>ANS: Read `en-US/main.ftl` from trunk<br/>(existing strings + "A")
61
+
note over ANS: Generate `en-US.pot` with all strings including "A"
62
+
GlotPress-->>ANS: Download `.po` translations for existing strings
63
+
note over ANS: Convert `.po` to `*/main.ftl` files
64
+
ANS->>Git: Create Pull Request targeting trunk
65
+
note right of Git: PR contains updated `en-US.pot` (with new string "A")<br/>and updated `*/main.ftl` files (existing translations only)
66
+
deactivate ANS
67
+
end
68
+
69
+
Dev->>Git: Merge Pull Request into trunk
70
+
note right of Git: `en-US.pot` with string "A" now available
71
+
72
+
activate wpcom
73
+
Git-->>wpcom: wpcom cron picks up updated `en-US.pot` from trunk
74
+
wpcom->>GlotPress: Import new `en-US.pot` with string "A"
75
+
deactivate wpcom
76
+
77
+
activate GlotPress
78
+
note over GlotPress: Translators work on new string "A"
79
+
deactivate GlotPress
80
+
81
+
Dev->>Git: Add new string "B" to `en-US/main.ftl` and commit to trunk
82
+
83
+
loop Nightly Sync (Run 2)
84
+
activate ANS
85
+
Git-->>ANS: Read `en-US/main.ftl` from trunk<br/>(existing + "A" + "B")
86
+
note over ANS: Generate `en-US.pot` with all strings including "A" and "B"
87
+
GlotPress-->>ANS: Download `.po` translations (now includes "A" translations)
88
+
note over ANS: Convert `.po` to `*/main.ftl` files
89
+
ANS->>Git: Create Pull Request targeting trunk
90
+
note right of Git: PR contains updated `en-US.pot` (with new string "B")<br/>and updated `*/main.ftl` files (including "A" translations)
91
+
deactivate ANS
92
+
end
93
+
94
+
Dev->>Git: Merge Pull Request into trunk
95
+
note right of Git: Translations for string "A" now in trunk
96
+
97
+
activate wpcom
98
+
Git-->>wpcom: wpcom cron picks up updated `en-US.pot` from trunk
99
+
wpcom->>GlotPress: Import new `en-US.pot` with string "B"
100
+
deactivate wpcom
101
+
102
+
activate GlotPress
103
+
note over GlotPress: Translators work on new string "B"
0 commit comments