text-expansion
它能做什么
这项技能检查 CSS 中会导致翻译文字错乱的固定尺寸和硬性截断。适用于支持多种语言的开发者和设计师。
适用场景
- ✓当按钮或标签有固定宽度,较长的语言会使其错乱的时候。
- ✓当网站即将被翻译成多种语言的时候。
- ✓当布局截断或隐藏了来自翻译文件的文字的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/text-expansion/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们要把应用翻译成德语,按钮会溢出。请帮我让布局能处理更长的文字。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在样式中找出固定宽度和硬性截断,并用灵活的尺寸替换它们,同时建议使用拉长的模拟语言进行测试。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Design UI components to accommodate text expansion from translation
Layouts designed only with English copy routinely break when translated: buttons overflow their containers, labels truncate, and navigation items wrap unexpectedly. Catching these issues early with pseudo-locale testing is far cheaper than fixing them after translations are delivered.
Quick Reference
- German translations are typically 30% longer than English; Finnish 50% longer
- Avoid fixed-width containers for text-bearing elements like buttons and labels
- Use min-inline-size instead of inline-size to allow natural growth
- Test with a pseudo-locale that inflates strings before committing translations
- Include pseudolocalization in CI or preview testing, not just manual QA
Check
Identify CSS rules and component styles that use fixed widths or hard truncation on elements containing translatable text, which would break when content expands in other languages. Check that the team can test a pseudolocalized build or preview.
Fix
Replace fixed inline-size with min-inline-size on text containers, remove overflow: hidden from interactive elements, and add a pseudo-locale build step for visual testing in local development and CI.
Explain
Explain how text expansion during translation breaks fixed layouts and what CSS patterns prevent overflow and clipping across locales.
Code Review
Review CSS files and component styles for fixed widths, overflow: hidden, white-space: nowrap, and text-overflow: ellipsis on buttons, labels, navigation items, and headings that contain translatable text.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/i18n/text-expansion
常见问题
翻译后的文字可以长多少?
这项技能指出,德语通常比英语长约 30%,芬兰语长约 50%。
什么是伪本地化?
这是网站的一个测试版本,使用加长的占位文字,使布局问题在真正的翻译到来之前就能显现。
应该在所有地方都去掉 overflow hidden 吗?
这项技能建议在交互元素上去掉它,因为隐藏的溢出内容可能会截断文字。
详情
作者的原始描述
Use when reviewing CSS for fixed dimensions, truncation, or overflow rules on elements that render translatable strings.
热度
- GitHub 星标
- 75k
- 排名
- #3052
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。