English | 简体中文
Lightweight, simple, flexible, automatic translation internationalization tool for JavaScript
To make internationalization easy and enjoyable 😄💪🏻
Variable Interpolation
, as well as unique type tag and formatting callbacks (numbers, currency, dates, times, plurals)Translation Text
is keyTaking
Translation Text
as key is the key to all the functions of the library. If you have any questions about this, Please see
The library is mainly composed of two parts
Command Line Tool:Parse the text that needs to be translated based on specified rules (regular expressions), translate the text to the specified target language through a translation platform, and finally generate language pack files
An example of parsing text using Matching Rules is as follows:
/** Normal string */
t('hello world')
t("hello world")
t(`hello world`)
/** Support Variable Interpolation */
t('hello {0}', 'developer friends'),
t('This is {0}, welcome to {1}. If you think {2}, please give {3} your support', ' `i18n-pro` ', 'use', `it's helpful for you`, ' ⭐️ ')
/** Interpolation Variable type tag need to be used with corresponding formatting callbacks */
// Number Type
t('The number of users has reached {n0}', 100000000)
// Currency Type
t('The selling price is {c0}', 14999)
// Date Type
t(`Today's date is {d0}`, new Date())
// Time Type
t('Current time: {t0}', new Date())
// Plural Type
t('I have {p0 apple}, {p1 banana} and {p2 pear}', 5, 4, 3)
Function API:Connect the international language package into the project, consisting of initI18n
, t
, setI18n
and withI18n
Translation Text
to achieve internationalization, and it is also used as a logo of the command line to match Translation Text
rulesTherefore, Command Line Tool
and Function API
work better together. It is precisely because of this structural design that i18n-pro
library can be easily integrated into any JavaScript
project
Copyright (c) 2022-present Eyelly Wu
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。