Skip to content

Commit 0ab272f

Browse files
Update workflow triggers to match tests.yml and use shorter report format
Co-authored-by: ArtyomVancyan <44609997+ArtyomVancyan@users.noreply.github.com>
1 parent 56b4971 commit 0ab272f

File tree

2 files changed

+16
-37
lines changed

2 files changed

+16
-37
lines changed

.github/workflows/locales.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: Update Locales
22

33
on:
4-
schedule:
5-
- cron: "0 0 * * 0"
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
68

79
jobs:
810
update:

scripts/check-locales/__main__.py

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,42 +42,19 @@
4242
all_missing = missing_from_antd | missing_from_mui
4343

4444
if all_missing:
45-
issue_body = "## Missing Locale Translations\n\n"
46-
issue_body += "This automated check has detected missing locale files in `react-phone-hooks` that are available in dependent packages.\n\n"
47-
issue_body += "### Summary\n\n"
48-
issue_body += f"**Total missing locales: {len(all_missing)}**\n\n"
45+
locale_sources = {}
46+
for locale in all_missing:
47+
sources = []
48+
if locale in missing_from_antd:
49+
sources.append('antd')
50+
if locale in missing_from_mui:
51+
sources.append('mui')
52+
locale_sources[locale] = sources
4953

50-
missing_locales = {}
51-
if missing_from_antd:
52-
missing_locales['antd'] = missing_from_antd
53-
if missing_from_mui:
54-
missing_locales['mui'] = missing_from_mui
55-
56-
for source, locales in missing_locales.items():
57-
if locales:
58-
issue_body += f"### Missing from {source}\n\n"
59-
for locale in sorted(locales):
60-
issue_body += f"- `{locale}`\n"
61-
issue_body += "\n"
62-
63-
issue_body += "### Action Required\n\n"
64-
issue_body += "Please add translation entries for the missing locales listed above. Each locale should include:\n"
65-
issue_body += "- `searchNotFound`: Translation for \"Country not found\"\n"
66-
issue_body += "- `searchPlaceholder`: Translation for \"Search country\"\n"
67-
issue_body += "- `countries`: Object mapping English country names to translations\n\n"
68-
issue_body += "### Example Structure\n\n"
69-
issue_body += "```typescript\n"
70-
issue_body += "export const enUS = {\n"
71-
issue_body += " searchNotFound: \"Country not found\",\n"
72-
issue_body += " searchPlaceholder: \"Search country\",\n"
73-
issue_body += " countries: {\n"
74-
issue_body += " \"United States\": \"United States\",\n"
75-
issue_body += " \"United Kingdom\": \"United Kingdom\",\n"
76-
issue_body += " },\n"
77-
issue_body += "}\n"
78-
issue_body += "```\n\n"
79-
issue_body += "---\n"
80-
issue_body += "*This issue was automatically generated by the locale detection script.*\n"
54+
issue_body = "Update the translations, adding the following language keys:\n\n"
55+
for locale in sorted(locale_sources.keys()):
56+
sources_str = ', '.join(f'`{s}`' for s in locale_sources[locale])
57+
issue_body += f" - `{locale}` ({sources_str})\n"
8158

8259
output_file = Path("/tmp/missing_locales_issue.md")
8360
with open(output_file, 'w') as f:

0 commit comments

Comments
 (0)