|
42 | 42 | all_missing = missing_from_antd | missing_from_mui |
43 | 43 |
|
44 | 44 | 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 |
49 | 53 |
|
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" |
81 | 58 |
|
82 | 59 | output_file = Path("/tmp/missing_locales_issue.md") |
83 | 60 | with open(output_file, 'w') as f: |
|
0 commit comments