Skip to content

Commit a364f98

Browse files
authored
Merge pull request #150 from Andygol:en-yml-update
Add GitHub Actions workflow to extract and update English menu strings in en.yml
2 parents 9c57ae9 + dd5a92f commit a364f98

File tree

5 files changed

+107
-23
lines changed

5 files changed

+107
-23
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Extract menu strings to en.yml
2+
3+
on:
4+
push:
5+
paths:
6+
- 'mkdocs.yml'
7+
8+
jobs:
9+
update-en-yml:
10+
name: Process changes in English menu items
11+
runs-on: ubuntu-latest
12+
outputs:
13+
has_changes: ${{ steps.check_changes.outputs.has_changes }}
14+
env:
15+
MKDOCS_FILE: "mkdocs.yml"
16+
TARGET_FILE: "./docs/en/en.yml"
17+
TMP_FILE: "$(mktemp)"
18+
19+
steps:
20+
- name: ⬇️ Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: 🧰 Set up yq
24+
uses: mikefarah/yq@v4
25+
26+
- name: 📝 Update en.yml
27+
run: |
28+
yq eval '(.plugins[].i18n.languages[] | select(.locale == "en")) | del(.default)' "$MKDOCS_FILE" > "$TMP_FILE"
29+
30+
yq eval --inplace "
31+
(.en.plugins[].i18n.languages[] | select(.locale == \"en\")) = load (\"$TMP_FILE\")
32+
" "$TARGET_FILE"
33+
34+
rm "$TMP_FILE"
35+
36+
- name: Check if something has been changed in en.yaml
37+
id: check_changes
38+
run: |
39+
git update-index --refresh
40+
if git diff-index --quiet HEAD -- "${TARGET_FILE}"; then
41+
echo "No changes detected"
42+
echo "has_changes=false" >> $GITHUB_OUTPUT
43+
else
44+
echo "Detected changes in en.yml"
45+
echo "has_changes=true" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Commit changes
49+
if: steps.check_changes.outputs.has_changes == 'true'
50+
run: |
51+
git config user.name "github-actions[bot]"
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
git add "${TARGET_FILE}"
54+
git commit -m "Changes in ${TARGET_FILE}"
55+
git push
56+
57+
- name: No changes detected
58+
if: steps.check_changes.outputs.has_changes == 'false'
59+
run: |
60+
echo "No changes to commit."

docs/en/en.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ en:
22
plugins:
33
- i18n:
44
languages:
5-
# ISO code of your language
6-
- locale: en
5+
- # ISO code of your language
6+
locale: en
77
# Name of your languge
88
name: English
99
# Day/Night toggle
1010
theme:
1111
palette:
12+
- toggle:
13+
name: Switch to light mode
1214
- toggle:
1315
name: Switch to dark mode
1416
- toggle:
15-
name: Switch to light mode
17+
name: Switch to system preference
1618
# Translate copyright statement
1719
copyright: © 2013–2023 OpenStreetMap and contributors, <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.0/" target="_blank"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/2.0/80x15.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.0/" target="_blank">Creative Commons Attribution-ShareAlike 2.0 Generic License</a>.
1820
nav_translations:
@@ -53,4 +55,4 @@ en:
5355
# Menu item name for the /providers.md
5456
Providers: Providers
5557
# Menu item name for the /find-out-more.md
56-
More: Getting help
58+
More: Getting help

docs/uk/uk.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@ uk:
22
plugins:
33
- i18n:
44
languages:
5-
# ISO code of your language
6-
- locale: uk
5+
- # ISO code of your language
6+
locale: uk
77
# Name of your languge
88
name: Українська
99
# Day/Night toggle
1010
theme:
1111
palette:
12+
- toggle:
13+
name: Увімкнути світлий режим
1214
- toggle:
1315
name: Увімкнути темний режим
1416
- toggle:
15-
name: Увімкнути світлий режим
17+
name: Увімкнути режим системи
1618
# Translate copyright statement
1719
copyright: "© 2013–2023 Учасники OpenStreetMap, <a rel=\"license\" href=\"https://creativecommons.org/licenses/by-sa/2.0/deed.uk\" target=\"_blank\"><img alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-sa/2.0/80x15.png\" /></a><br />Матеріали цього сайту ліцензуються на умовах Ліцензії – <a rel=\"license\" href=\"https://creativecommons.org/licenses/by-sa/2.0/deed.uk\" target=\"_blank\">Creative Commons Attribution-ShareAlike 2.0 Generic License</a>."
1820
nav_translations:
1921
# Menu item name for the /index.md
2022
Home: Switch2OSM
2123
# Menu item name for the /why-switch.md
22-
Why: "Навіщо?"
24+
Why: Навіщо?
2325
# Menu item name for the /case-studies.md
2426
Cases: Вже з OSM
2527
# Menu item name for the /the-basics.md
@@ -53,4 +55,4 @@ uk:
5355
# Menu item name for the /providers.md
5456
Providers: Постачальники
5557
# Menu item name for the /find-out-more.md
56-
More: Отримання допомоги
58+
More: Отримання допомоги

docs/zh-TW/zh-TW.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ zh_TW:
22
plugins:
33
- i18n:
44
languages:
5-
# ISO code of your language
6-
- locale: zh-TW
5+
- # ISO code of your language
6+
locale: zh-TW
77
# Name of your languge
88
name: 台灣華語
99
# Day/Night toggle
1010
theme:
1111
palette:
12+
- toggle:
13+
name: 切換到燈光模式
1214
- toggle:
1315
name: 切換到深色模式
1416
- toggle:
15-
name: 切換到燈光模式
17+
name: 切換到系統偏好設定
1618
# Translate copyright statement
1719
copyright: "© 2013–2023 開放街圖與貢獻者。 <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\" target=\"_blank\"><img alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-sa/2.0/80x15.png\" /></a><br />這些資料採用 <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\" target=\"_blank\">創用CC相同方式分享 2.0 未本地化授權條款</a>。"
1820
nav_translations:
@@ -53,4 +55,4 @@ zh_TW:
5355
# Menu item name for the /providers.md
5456
Providers: 提供者
5557
# Menu item name for the /find-out-more.md
56-
More: 取得協助
58+
More: 取得協助

mkdocs.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,25 +139,25 @@ nav:
139139

140140
plugins:
141141
- search:
142-
lang:
143-
- en
144-
- uk
145-
- zh-TW
142+
lang: [en, uk, zh-TW]
146143
- macros
147144
- ezlinks
148145
- glightbox
149146
- section-index
150147

151-
# This part is for organising languages in specific folders
152-
# Using a folder per language structure
153-
# https://ultrabug.github.io/mkdocs-static-i18n/
148+
# This part is for organising languages in specific folders
149+
# Using a folder per language structure
150+
# https://ultrabug.github.io/mkdocs-static-i18n/
154151
- i18n:
155152
docs_structure: folder
156153
reconfigure_material: true
157154
languages:
158-
- locale: en
155+
- # ISO code of your language
156+
locale: en
157+
# Name of your languge
159158
name: English
160159
default: true
160+
# Day/Night toggle
161161
theme:
162162
palette:
163163
- toggle:
@@ -166,28 +166,46 @@ plugins:
166166
name: Switch to dark mode
167167
- toggle:
168168
name: Switch to system preference
169+
# Translate copyright statement
169170
copyright: © 2013–2023 OpenStreetMap and contributors, <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.0/" target="_blank"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/2.0/80x15.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.0/" target="_blank">Creative Commons Attribution-ShareAlike 2.0 Generic License</a>.
170171
nav_translations:
172+
# Menu item name for the /index.md
171173
Home: Switch2OSM
174+
# Menu item name for the /why-switch.md
172175
Why: Why Switch?
176+
# Menu item name for the /case-studies.md
173177
Cases: Case Studies
178+
# Menu item name for the /the-basics.md
174179
Basics: The Basics
180+
# Menu item name for the "Using Tiles" tab
175181
Using: Using Tiles
176-
# Own tiles: Switch to using OSM tiles
182+
# Menu item name for the side menu
177183
Leaflet: Getting started with Leaflet
184+
# Menu item name for the side menu
178185
OpenLayers: Getting started with OpenLayers
186+
# Menu item name for the side menu
179187
Vector Tiles: Power of Vector Map Tiles
188+
# Menu item name for the "Serving Tiles" tab
180189
Serving: Serving Tiles
181-
# Serving tiles: Serving your own tiles
190+
# Serving tiles: Manually building a tile server
182191
Manually: Manually building a tile server
192+
# Serving tiles: Using a Docker container
183193
Docker: Using a Docker container
194+
# Serving tiles: Monitoring using Munin
184195
Munin: Monitoring using Munin
196+
# Serving tiles: Updating your database as people edit OpenStreetMap
185197
Updating: Updating your database as people edit OpenStreetMap
198+
# Serving tiles: Vector Map Tiles
186199
Serving vector tiles: Vector Map Tiles
200+
# Vector Map Tiles: Steps to Serve Vector Map Tiles
187201
Steps: General steps
202+
# Vector Map Tiles: Getting started with TileServer GL
188203
TileServer GL: Getting started with TileServer GL
204+
# Menu item name for the /other-uses.md
189205
Other: Other Uses
206+
# Menu item name for the /providers.md
190207
Providers: Providers
208+
# Menu item name for the /find-out-more.md
191209
More: Getting help
192210
- locale: uk
193211
name: Українська

0 commit comments

Comments
 (0)