# 多语言支持

Waline 的多语言翻译以及字段都是沿用了 Valine 的配置,在此非常感谢!

# 基本用法

Waline 支持多语言。默认内置:

  • zh
  • zh-CN
  • zh-TW
  • en
  • en-US
  • jp
  • jp-JP
new Waline({
  el: '#waline',
  lang: 'en', // 设置这里就ok
});
1
2
3
4

# 自定义语言

自定义语言只需两步:

  1. 定义langMode
  2. 初始化 Waline

请严格按照下面的langMode格式书写内容:

// 1.定义 langMode
var langMode = {
  nick: 'NickName',
  mail: 'E-Mail',
  link: 'Website(http://)',
  nickFail: 'NickName cannot be less than 3 bytes.',
  mailFail: 'Please confirm your email address.',
  sofa: 'No comment yet.',
  submit: 'Submit',
  reply: 'Reply',
  cancelReply: 'Cancel reply',
  comments: 'Comments',
  cancel: 'Cancel',
  confirm: 'Confirm',
  continue: 'Continue',
  more: 'Load More...',
  preview: 'Preview',
  emoji: 'Emoji',
  expand: 'See more....',
  seconds: 'seconds ago',
  minutes: 'minutes ago',
  hours: 'hours ago',
  days: 'days ago',
  now: 'just now',
  uploading: 'Uploading ...',
  uploadDone: 'Upload completed!',
  busy: 'Submit is busy, please wait...',
  'code-98':
    'Waline initialization failed, please check your version of av-min.js.',
  'code-99':
    'Waline initialization failed, Please check the `el` element in the init method.',
  'code-100':
    'Waline initialization failed, Please check your appId and appKey.',
  'code-140':
    'The total number of API calls today has exceeded the development version limit.',
  'code-401': 'Unauthorized operation, Please check your appId and appKey.',
  'code-403':
    'Access denied by API domain white list, Please check your security domain.',
};

// 2.初始化 Waline
new Waline({
  el: '#waline',
  path: location.pathname,
  serverURL: 'YOUR_SERVER_URL',
  langMode: langMode,
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47