如何在Go中处理国际化(i18n)?

huangapple go评论77阅读模式
英文:

How to handle i18n in Go?

问题

我在网上搜索了一下,但没有找到与i18n和Go相关的任何内容。

我希望使用Go来开发网站。处理国际化的最佳方式是什么?

英文:

I searched on web but I didn't find anything related to i18n and Go.

I wish to use Go for develop web sites. What is the best way to handle internationalization?

答案1

得分: 14

go-i18n有一些不错的特性:

英文:

go-i18n has some nice features:

答案2

得分: 9

> 软件包路线图
>
> 全面支持国际化文本。
> 支持国际化日期、时间等。
> 支持多语言消息。

正如您从Go路线图中所看到的,Go目前还没有提供完整的国际化支持。

英文:

> Packages roadmap
>
> Comprehensive support for international text.
> Support for international dates, times, etc.
> Support for multilingual messages.

As you can see from the Go Roadmap, Go doesn't provide full i18n support yet.

答案3

得分: 6

新的模板包允许您向模板的函数映射中添加一个函数,该函数将给定的字符串转换为本地化版本。目前,底层发生的情况取决于您,因为语言选择可能基于浏览器发送的标头。

这是在Web应用程序中添加本地化消息的一个非常基本的用例。

迫不及待地期待国际化、本地日期和时间格式的适当支持。

英文:

The new template package allows you to at add a function to template's function map, that would transform the given string to a localized version. What's going on underneath would be up to you for now, as the language choice could be based on headers sent by the browser.

That's a very basic use case for adding localized messages in a web app, for one.

Can't wait for the proper support for internationalization, local date and time formats.

huangapple
  • 本文由 发表于 2011年9月28日 23:09:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/7585362.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定