来自语言学的教训:前端开发者的i18n最佳实践

Opens in a new windowOpens an external siteOpens an external site in a new window

在新窗口打开在新窗口打开一个外部网站在新窗口打开一个外部网站

In our globalized and interconnected world, apps and websites are increasingly being targeted at an international audience. Developers are more likely than ever to be working with content that is intended to be served in several languages. For instance, the Shopify admin is available in 21 languages.

在我们全球化和相互联系的世界中,应用程序和网站越来越多地以国际受众为目标。开发人员比以往任何时候都更有可能处理要以多种语言提供的内容。例如,Shopify的管理员有21种语言版本。

There are many powerful tools available to us to help us in our internationalization (i18n) workflows. Whatever your programming language or front-end framework of choice, there will most likely be an open source library ready to handle the more tricky aspects of translation, such as differing pluralization rules, or complex formatting of dates or currencies.

有许多强大的工具可以帮助我们完成国际化(i18n)的工作流程。无论你选择什么样的编程语言或前端框架,很可能会有一个开源库准备好处理翻译中比较棘手的方面,如不同的复数规则,或复杂的日期或货币格式。

They aren't magic though! If you simply took an English-language website, moved all of the text strings into language files according to your chosen i18n library, and translated all of those strings as-is, you would almost certainly find errors when viewing the site in other languages, ranging from small grammatical errors to fully garbled sentences. It's natural for us to bake into our code our own internalized assumptions about language based on the ones we know, and the cracks may only show in translation.

但它们并不神奇!如果你只是简单地把一个英语网站,根据你所选择的i18n库把所有的文本字符串移到语言文件中,然后按原样翻译所有的字符串,你几乎肯定会在用其他语言查看网站时发现错误,从小的语法错误到完全乱码的句子。我们很自然地将自己对语言的内化假设基于我们所知道的内化假设植入我们的代码中,而这些裂痕可能只在翻译中显示出来。

Throughout this post, we’ll look at various ways that English grammar can be internalized in code, leading to errors in translation, and at the end I'll provide some development best practices to help you avoid these common pitfalls.

在这篇文章中,我们将探讨英语语法在代码中内化的各种方式,导致翻译中的错误,最后我将提供一些开发的最佳实践来帮助你避免这些常见的陷阱。

A Simple E...

开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.139.0. UTC+08:00, 2024-12-22 14:09
浙ICP备14020137号-1 $访客地图$