簡介i18n

如果一個應用程式在設計時,可以在不修改應用程式的情況下,根據不同的使用者直接採用不同的語言、數字格式、日期格式等,這樣的設計考量稱為國際化(internationalization),簡稱i18n(因為internationalization中間有18個字母)。

Rails中地區(Locale)資訊可使用字串設定,若要同時指定語言與區域,慣例上使用-區隔,例如"zh-TW",應用程式預設的地區設定可用I18n.default_locale取得,如果沒有作任何設定,預設是"en",可設定config/application.rb中的config.i18n.default_locale選項來指定。例如:

config.i18n.default_locale="zh-TW"

應用程式採用的地區資訊由I18n.locale決定,預設值與I18n.default_locale相同,也就是"en"。

地區資訊要搭配翻譯詞彙檔來使用,預設翻譯詞彙檔的載入路徑為config/locales,例如應用程式預設會有個en.yml如下:

<%=t:hello%>

如果I18n.locale的值是"en",那麼就會尋找en.yml中hello:的對應伺彙,假設你有個zh-TW.yml:

zh-TW:hello:"哈囉!世界!"如果你設定I18n.locale為"zh-TW",那麼就會尋找zh-TW.yml中hello:對應詞彙。

其實yml主檔名無關緊要,主要是yml第一層要對應地區設定,才有辦法找到對應詞彙。如果找不到對應詞彙,那就會直接使用指定的Symbol,例如:hello就顯示Hello,如果是:hello_world就會顯示HelloWorld,如果想指定沒有對應詞彙時的預設詞彙,可以使用:default:

<%=t:hello,:default=>"Hello!"%>

:default也可以設定尋找順序。例如找不到:hello就尋找:hi,要不然就使用最後指定的文字:

<%=t:hello,:default=>[:hi,"Hello!"]%>

I18n.t方法可以直接指定:locale選項。例如:

<%=t:hello,:locale=>"en"%>
<%=t:hello,:locale=>"zh-TW"%>
<%=t:hello,:locale=>"zh-GB"%>

THE END
1.JAVA(Springboot)i18n国际化语言配置javai18n一、i18n 介绍 在Java中,国际化(Internationalization,通常简称为i18n)是一个过程,它允许应用程序适应不同的语言和地区设置,从而能够支持全球用户。Java平台为国际化提供了强大的支持,包括Locale类、ResourceBundle类以及用于格式化日期、数字和货币的类。 二、i18n 功能 https://blog.csdn.net/weixin_47054648/article/details/139297375
2.国际化(i18n)语言环境配置指南### 摘要 本文旨在介绍如何在软件或网站中实现多语言支持,即国际化(i18n)。文中详细列出了支持的语言环境,并提供了安装步骤、使用方法及实用技巧。此外,还特别感谢了贡献者,并明确了文章的许可协议。 ### 关键词 国际化, 多语言, 配置, 技巧, 许可 ## 一、国际化(i18n)概述 ### 1.1 什么是国际化(i18n)https://www.showapi.com/news/article/66b2e53a4ddd79f11a006c94
3.i18nIt is easy to translate a Docusaurus website with its internationalization (i18n) support.https://docusaurus.io/zh-CN/docs/i18n/introduction
4.i18nUm die Sprache zu erhalten, verwenden Sie i18n.getUILanguage. i18n.getMessage() Ermittelt die lokalisierte Zeichenfolge für die angegebene Nachricht. i18n.getUILanguage() Ermittelt die UI-Sprache des Browsers. Dies unterscheidet sich von i18n.getAcceptLanguages, die die bevorzugten Benutzersprachenhttps://developer.mozilla.org/de/docs/Mozilla/Add-ons/WebExtensions/API/i18n
5.I18nDebian wiki's internationalization (i18n) and localization (l10n) portal. Debian has many services, softwares, interfaces and infrastructures to handle the complexity of its operations. Most of these mechanisms were built using English as the primary (and many times, the only) language. In orderhttps://wiki.debian.org/I18n
6.i18nThe options in i18n.create, i18n.edit and i18n.remove are all used only when the Buttons extension (or TableTools for legacy installations) is also used. If you are not using Buttons, these options will have no effect on Editor. In such a case, the strings that the user sees can be https://editor.datatables.net/reference/option/i18n
7.i18nRubyGems.org您的社区Gem托管中心i18n 1.4.0 单击箭头图标展开。Runtime : concurrent-ruby 1.3.5 ~> 1.0 状态 服务运行时间 源代码 数据 讨论 统计 贡献 关于 帮助 API Policies 安全 RubyGems.org 是 Ruby 社区的 Gem 托管服务。立即 发布您的 Gem 并安装它们。 使用 API 来查找更多 可用的 Gem。 快来成为一名贡献者吧! 由您自己https://index.rubygems.org/gems/i18n/versions/1.4.0/dependencies
8.i18n是什么意思i18n在线翻译英语读音用法例句i18n 英美 n.internationalization 的缩写形式;意即在 i 和 n 之间有 18 个字母;本意是指软件的"国际化" Created with Highcharts 3.0.2释义常用度分布图海词统计 本意是指.. 意即在 i.. 分享单词到:http://dict.cn/i18n
9.添加i18n功能Docs在这个指南中,你将学习如何使用内容集合和动态路由来构建你自己的国际化(i18n)解决方案,并针对不同的语言提供你的内容。提示 在v4.0 中,Astro 添加了对 i18n 路由的内置支持,允许你配置默认和支持的语言,并包含有用的辅助函数来帮助你服务于国际受众。如果你想使用它,可以查看我们的国际化指南来了解这些功能。https://docs.astro.build/zh-cn/recipes/i18n/
10.国际化i18n·mpx文档国际化i18n Mpx支持国际化i18n,使用方式及支持能力与vue-i18n非常接近 使用方法 Mpx自带i18n能力,无需额外安装插件。由于小程序模板中的i18n函数是通过wxs编译注入进行实现,我们需要将i18n配置传入到MpxWebpackPlugin中来使i18n生效,这是与vue-i18n最大的区别https://didi.github.io/mpx/i18n.html
11.国际化(I18n)为了方便开发多语言应用,框架内置了国际化(I18n)支持,由egg-i18n插件提供。 #默认语言 默认语言是en-US。假设我们想修改默认语言为简体中文: // config/config.default.js exports.i18n = { defaultLocale:'zh-CN', }; #切换语言 我们可以通过下面几种方式修改应用的当前语言(修改后会记录到locale这个 Cookie)http://doc.yaojieyun.com/eggjs.org/zh-cn/core/i18n.html
12.国际化(i18n)—VuetifyVuetify 支持其组件的语言国际化(i18n)。 Edit this page 报告Bug 打开议题 在GitHub 上查看 当启动您的应用程序时,您可以使用默认区域设置为选项指定可用区域和默认区域设置。本地化服务也支持与vue-i18n的简单整合。 使用具有RTL(右至左) 语言的区域设置也会影响到Vuetify组件的方向。 https://vuetifyjs.com/zh-Hans/features/internationalization/
13.I18N/zhcnFedora I18n 团队维护一堆与 Fedora 国际化有关的软件包。一个叫做 i18n-team 的 FAS 伪用户负责跟踪有关 bug。 最新的被批准的软件包请使用 "InitialCC: i18n-team" 命令在 CVS 中获取。 技术方面 输入法 主要是一些亚洲地区的输入法。 https://fedoraproject.org/wiki/I18N/zh-cn
14.JQueryI18N<System<FoswikiJQueryI18N Homepage:https://foswiki.org/Extensions/JQueryPlugin Author(s): Michael Daum Version: 1.1 On this page: Summary Translations Language detection Loading translations Format of translation files Inline translations Translating a string Summaryhttps://pandax.physics.sjtu.edu.cn/foswiki/System/JQueryI18N
15.VueI18nInternationalization plugin for Vue.js Easy, powerful, and component-oriented for Vue.js Get Started View on GitHubhttps://vue-i18n.intlify.dev/
16.Internationalization(i18n)GoogleforDevelopersECMAScript i18n API ECMAScript Internationalization API 針對 JavaScript 提供可辨識語言的關鍵功能。 repeat 關閉雙向文字工具 如果您要使用由右至左 (RTL) 的語言 (包括阿拉伯文、希伯來文、波斯文和烏都文) 翻譯應用程式,就很適合使用 BiDi 文字處理功能。 https://developers.google.cn/international?hl=zh-tw
17.pythonimport i18n i18n.load_path.append('/path/to/translations') i18n.t('foo.hi') # Hello world ! Please note that YAML format is used as default file format if you have yaml module installed. If both yaml and json modules available and you want to use JSON to store translations, explicitlyhttps://pypi.org/project/python-i18n/
18.聊聊什么是i18n?JavaScript中的i18n基本概念i18n 全称 Internationalization,也就是国际化的意思,因为单词太长,所以中间的 18 个字母被缩写为 18,再加上开头和结尾的字母,就组成了 i18n。 JavaScript i18n API 可以帮助我们对网站进行多语言翻译,让它们可以轻松适应使用不同语言用户的需求。 在本文中,我将介绍 i18n API 提供的各种方法,以及如何在实际项目中https://developer.aliyun.com/article/1266640
19.i18n实现前端国际化(实例)varLANGUAGE_Index="zh_CN";//标识语言jQuery(document).ready(function(){// alert("页面加载时调用的方法");LANGUAGE_Index=jQuery.i18n.normaliseLanguageCode({});//获取浏览器的语言loadProperties(LANGUAGE_Index);});$(".lan_select").change(function(){if(($(".lan_select").val()==="英文")|https://www.miaokee.com/2806840.html
20.OpenHarmony国际化I18n开发范例本例基于国际化示例应用,为大家介绍I18n组件,该组件提供系统相关的或者增强的国际化能力。 想了解更多关于开源的内容,请访问: 51CTO 开源基础软件社区 https://ost.51cto.com 概念介绍 在开发应用中可能会遇到多国家多地区场景,应用要提供不同的语言、时间、时区给目标用户和市场,开发者往往需要提供多个不同版本以保https://www.51cto.com/article/765617.html
21.vuei18nbridge? What isvue-i18n-bridge? vue-i18n-bridgeis a bridge to make the upgrade as easy as possible between vue-i18n@v8.26.1 or later andvue-i18n@v9.x. It can be used in Vue 2 applications that you have already built with vue-i18n@v8.26.1 or later. http://www.npmjs.com/package/vue-i18n-bridge