Hello World

Translating your interface

All chapters

Part 2 · Words

Translating your interface

Chapter 6 12 min read 12 sections

Picture a settings page with two forms. One lets you change your own name. The other lets you rename your team. Both forms have a field labelled "Name", so the English text is identical, and it's tempting to reuse the same string for both.

In Chinese, those two labels need different words. A person's name is 名字 (míngzì). The name of a team, a product or any other thing is 名称 (míngchēng). Use 名字 for the team and it reads wrong to every Chinese user who sees it.

<title id="g1-title">One English label, two Chinese words</title> Three columns of the same two settings forms. In English, the profile form and the team form both label their field Name. Translated from one shared string, both Chinese forms say 名字, which is wrong for the team. Translated from two keys, the profile says 名字 and the team says 名称, the word for the name of a thing. ENGLISH Your profile Name Li Wei Team settings Name Design team ONE SHARED STRING 个人资料 名字 李伟 团队设置 名字 设计团队 TWO KEYS 个人资料 名字 李伟 团队设置 名称 设计团队

Whether your translator can fix that depends on decisions you made long before they saw the text. This chapter covers those decisions: where your translated text lives, how your code asks for it, and how you hand it over to translators and get it back again.

Keep reading

The rest of this chapter is for readers of the book

Get the book to read the rest of this chapter and every other one, the field guide and the glossary, and to download the whole book as a PDF.

Still to come in this chapter

  • Two kinds of text
  • Translation databases
  • Translation functions
  • Option 1: full text in source code
  • Option 2: translation keys
  • Making keys readable in your editor
  • Giving translators context
  • gettext, PO files and Poedit
  • Other file formats
  • Getting translations to the front end
  • Checklist
  • Further reading