跳到正文
Skillpedia
网站与界面(前端)75k · #3052

text-expansion

它能做什么

这项技能检查 CSS 中会导致翻译文字错乱的固定尺寸和硬性截断。适用于支持多种语言的开发者和设计师。

适用场景

  • ✓当按钮或标签有固定宽度,较长的语言会使其错乱的时候。
  • ✓当网站即将被翻译成多种语言的时候。
  • ✓当布局截断或隐藏了来自翻译文件的文字的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/text-expansion/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/text-expansion/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#3052
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能