hexo-i18n

WebJar for hexo-i18n

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

hexo-i18n
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

hexo-i18n
WebJar for hexo-i18n
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/hexojs/hexo-i18n

Скачать hexo-i18n

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/hexo-i18n/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>hexo-i18n</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/hexo-i18n/
implementation 'org.webjars.npm:hexo-i18n:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/hexo-i18n/
implementation ("org.webjars.npm:hexo-i18n:1.0.0")
'org.webjars.npm:hexo-i18n:jar:1.0.0'
<dependency org="org.webjars.npm" name="hexo-i18n" rev="1.0.0">
  <artifact name="hexo-i18n" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='hexo-i18n', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "hexo-i18n" % "1.0.0"
[org.webjars.npm/hexo-i18n "1.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : sprintf-js jar [1.0.3,2)

Модули Проекта

Данный проект не имеет модулей.

hexo-i18n

Build Status NPM version Coverage Status

i18n module for Hexo.

Installation

$ npm install hexo-i18n --save

Usage

Example

var i18n = new require('hexo-i18n')({
  languages: ['zh-TW', 'en']
});

i18n.set('en', {
  ok: 'OK',
  name: 'My name is %1$s %2$s.',
  index: {
    title: 'Home'
  },
  video: {
    zero: 'No videos',
    one: 'A video',
    other: '%d videos'
  }
});

i18n.set('zh-TW', {
  name: '我的名字是 %2$s %1$s。',
  index: {
    title: '首頁'
  },
  video: {
    zero: '沒有影片',
    one: '一部影片',
    other: '%d 部影片'
  }
});

var __ = i18n.__();
var _p = i18n._p();

__('ok') // OK
__('index.title') // 首頁
__('name', '大呆', '王') // 我的名字是王大呆
_p('video', 0) // 沒有影片
_p('video', 1) // 一部影片
_p('video', 10) // 10 部影片

new i18n([options])

Creates a new i18n instance.

Option Description Default
languages Default languages. It can be an array or a string default

i18n.get([lang]) → Object

Returns a set of localization data. lang can be an array or a string, or the default language defined in constructor if not set. This method will build the data in order of languages.

i18n.set(lang, data)

Loads localization data.

i18n.remove(lang)

Unloads localization data.

i18n.list()

Lists loaded languages.

i18n.__() → Function(key, arg...)

Returns a function for localization.

i18n._p() → Function(key, count, ...)

This method is similar to i18n.__, but it returns pluralized string based on the second parameter. For example:

_p('video', 0) = __('video.zero', 0)
_p('video', 1) = __('video.one', 1)
_p('video', 10) = __('video.other', 10)

License

MIT

org.webjars.npm

Hexo

A fast, simple & powerful blog framework, powered by Node.js.

Версии библиотеки

Версия
1.0.0