Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(i18n): add i18n support for sidebar #353

Merged
merged 4 commits into from
Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ workflows:
jobs:
- path-filtering/filter:
mapping: |
(cmd|internal|server|pkg|test)/.* trigger-app true
main.go|go.mod|go.sum|artalk.example.yml trigger-app true
(cmd|internal|server|pkg|test|conf)/.* trigger-app true
main.go|go.mod|go.sum trigger-app true
(ui)/.* trigger-ui true
base-revision: master # git branch name
config-path: .circleci/conditional_config.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
# build
- name: setup release environment
run: |-
cp artalk.example.yml artalk.yml
cp conf/artalk.example.yml artalk.yml
echo 'GITHUB_TOKEN=${{secrets.GORELEASER_ACCESS_TOKEN}}' > .release-env

- name: build and release publish
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func credentials() (string, string, string, error) {
}

fmt.Println()
fmt.Print(i18n.T("Retype {{name}}", map[string]interface{}{"name": i18n.T("Password")}) + ": " + ": ")
fmt.Print(i18n.T("Retype {{name}}", map[string]interface{}{"name": i18n.T("Password")}) + ": ")
byteRePassword, err := term.ReadPassword(int(syscall.Stdin))
if err != nil {
return "", "", "", err
Expand Down
File renamed without changes.
120 changes: 72 additions & 48 deletions artalk.example.yml → conf/artalk.example.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
# Listen host
host: "0.0.0.0"

# Listen port
port: 23366
# Key for generation of JWT token

# App Key (for generation of JWT token)
app_key: ""

# Debug mode
debug: false

# Language (follow Unicode BCP 47)
# -- see https://www.techonthenet.com/js/language_tags.php --
locale: "en"
# Timezone (see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)

# Timezone (follow IANA Time Zone Database)
# -- see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones --
timezone: "Asia/Shanghai"
# Default site name

# Default site name (create when app is first launched)
site_default: "Default Site"

# Login timeout (in seconds)
login_timeout: 259200

# Database
db:
# Database type ["sqlite", "mysql", "pgsql", "mssql"]
Expand All @@ -22,7 +32,7 @@ db:
file: "./data/artalk.db"
# Table prefix (e.g. "atk_")
table_prefix: ""
# The following is not nessary for SQLite
# -- The following is not necessary for SQLite --
# Database name
name: "artalk"
# Host address
Expand All @@ -42,6 +52,7 @@ log:
enabled: true
# Log file path
filename: "./data/artalk.log"

# Cache
cache:
# Cache type ["redis", "memcache", "builtin"]
Expand All @@ -50,6 +61,7 @@ cache:
expires: 30
# Cache warm up (warm up cache when program starts)
warm_up: false
# -- The following is not necessary for `builtin` cache --
# Cache server address (e.g. "localhost:6379")
server: ""
# Redis config
Expand All @@ -62,23 +74,24 @@ cache:
password: ""
# Redis database number (e.g. 0)
db: 0
# Trusted domains, e.g. ["https://artalk.example.com:23366"] add url of your site her

# Trusted domains
# -- e.g. ["https://artalk.example.com:23366"] add url of your site her --
trusted_domains: []

# SSL
ssl:
# Enable SSL
enabled: false
# Certificate file path, e.g. "/etc/letsencrypt/live/example.com/fullchain.pem"
# Certificate file path
# (e.g. "/etc/letsencrypt/live/example.com/fullchain.pem")
cert_path: ""
# Key file path, e.g. "/etc/letsencrypt/live/example.com/privkey.pem"
# Key file path
# (e.g. "/etc/letsencrypt/live/example.com/privkey.pem")
key_path: ""
# Admin users
admin_users:
# Remove the following line comment symbol (#) to enable admin users
# - name: "admin"
# email: "[email protected]"
# badge_color: "#FF6C00"
# Comment examination before being public

# Moderator
# -- Comment examination before being public --
moderator:
# Default pending (new comments need to be approved by admin)
pending_default: false
Expand All @@ -87,15 +100,17 @@ moderator:
# Akismet Key
# (Akismet anti-spam service, https://akismet.com)
akismet_key: ""
# Auto review comments with Tencent Cloud Content Security
# (https://cloud.tencent.com/document/product/1124/64508)
# Tencent Cloud Content Security
# (Auto review comments with Tencent Cloud Content Security)
# -- see https://cloud.tencent.com/document/product/1124/64508 --
tencent:
enabled: false
secret_id: ""
secret_key: ""
region: "ap-guangzhou"
# Auto review comments with Aliyun Content Security
# (https://help.aliyun.com/document_detail/28417.html)
# Aliyun Content Security
# (Auto review comments with Aliyun Content Security)
# -- see https://help.aliyun.com/document_detail/28417.html --
aliyun:
enabled: false
access_key_id: ""
Expand All @@ -111,36 +126,60 @@ moderator:
files:
file_sep: "\n"
replac_to: "x"

# Captcha
captcha:
# Enable captcha
enabled: true
# Captcha is required always
always: false
# Captcha type ["geetest", "image"]
# The number of actions required to activate captcha
captcha_type: "image"
# Action limit
# (the number of actions required to activate captcha)
action_limit: 3
# Timeout to reset action counter (unit: s, set to -1 to disable)
# Reset Timeout (timeout to reset action counter. unit: s, set to -1 to disable)
action_reset: 60
# Geetest (https://www.geetest.com)
geetest:
enabled: false
captcha_id: ""
captcha_key: ""
# Mail notification

# Upload
img_upload:
# Enable image upload
enabled: true
# Image storage
path: "./data/artalk-img/"
# Image size limit (unit: MB)
max_size: 5
# Image link base path (default: "/static/images/")
public_path: null
# Upgit config
upgit:
# Enable Upgit
enabled: false
# Command line arguments
exec: "./upgit -c UPGIT_CONF_FILE_PATH -t /artalk-img"
# Delete local image after upload success
del_local: true

# Email
email:
# Enable mail notification
# Enable email notification
enabled: false
# Send method ["smtp", "ali_dm", "sendmail"]
send_type: "smtp"
# Nick name of sender
send_name: "{{reply_nick}}"
# Email address of sender
send_addr: "[email protected]"
# Mail title
# Mail template file (set to file path to use custom template)
# Email subject
mail_subject: "[{{site_name}}] You got a reply from @{{reply_nick}}"
# Email template file (set to file path to use custom template)
mail_tpl: "default"
# SMTP send (set to "smtp" to enable)
# SMTP send (set send method to "smtp" to enable)
smtp:
# Email address of sender
host: "smtp.qq.com"
Expand All @@ -156,38 +195,21 @@ email:
access_key_id: ""
access_key_secret: ""
account_name: "[email protected]"
# Image upload for comment
img_upload:
# Enable image upload
enabled: true
# Image storage
path: "./data/artalk-img/"
# Image size limit (unit: MB)
max_size: 5
# Image link base path (default: "/static/images/")
public_path: null
# Upgit config
upgit:
# Enable Upgit
enabled: false
# Command line arguments
exec: "./upgit -c UPGIT_CONF_FILE_PATH -t /artalk-img"
# Delete local image after upload success
del_local: true

# Multi-push
admin_notify:
# Notification template (set to file path to use custom template)
notify_tpl: "default"
# Noise mode
# noise_mode is disabled by default.
# When this option is set to `false`, only messages sent to the administrator will be notified,
# such as "user A" replies to "user B", the communication between these two users will not be notified to the administrator.
# -- noise_mode is disabled by default. --
# -- When this option is set to `false`, only messages sent to the administrator will be notified, --
# -- such as "user A" replies to "user B", the communication between these two users will not be notified to the administrator. --
noise_mode: false
# Notify admin
email:
# Enable (can be disabled when using other push methods)
enabled: true
# Mail title (mail title sent to admin)
# Email subject (email subject sent to admin)
mail_subject: '[{{site_name}}] Post "{{page_title}}" has new a comment'
# Telegram
telegram:
Expand Down Expand Up @@ -224,14 +246,16 @@ admin_notify:
receivers:
- "USER_ID_1"
- "GROUP_ID_1"
# Frontend config

# UI Settings
frontend:
# Comment box placeholder
placeholder: "What do you think?"
# Text to display when there is
noComment: "No comments yet."
# Text of the send button
sendBtn: "Send"
# Movable comment box
editorTravel: true
# Dark mode
darkMode: false
Expand Down
40 changes: 20 additions & 20 deletions artalk.example.zh-CN.yml → conf/artalk.example.zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,26 @@ captcha:
captcha_id: ""
captcha_key: ""

# 图片上传
img_upload:
# 启用图片上传
enabled: true
# 图片存放路径
path: "./data/artalk-img/"
# 图片大小限制 (单位:MB)
max_size: 5
# 图片链接基础路径 (默认为 "/static/images/")
public_path: null
# Upgit 配置
# (使用 Upgit 将图片上传到 GitHub 或图床:https://github.com/pluveto/upgit)
upgit:
# 启用 Upgit
enabled: false
# 命令行参数
exec: "./upgit -c <upgit配置文件路径> -t /artalk-img"
# 上传后删除本地的图片
del_local: true

# 邮件通知
email:
# 启用邮件通知
Expand Down Expand Up @@ -174,26 +194,6 @@ email:
access_key_secret: ""
account_name: "[email protected]"

# 图片上传
img_upload:
# 启用图片上传
enabled: true
# 图片存放路径
path: "./data/artalk-img/"
# 图片大小限制 (单位:MB)
max_size: 5
# 图片链接基础路径 (默认为 "/static/images/")
public_path: null
# Upgit 配置
# (使用 Upgit 将图片上传到 GitHub 或图床:https://github.com/pluveto/upgit)
upgit:
# 启用 Upgit
enabled: false
# 命令行参数
exec: "./upgit -c <upgit配置文件路径> -t /artalk-img"
# 上传后删除本地的图片
del_local: true

# 多元推送
admin_notify:
# 通知模版 (填入文件路径使用自定义模板)
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/backend/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ git clone https://github.com/ArtalkJS/Artalk.git Artalk
cd Artalk && make all

# 配置文件
cp artalk.example.yml artalk.yml
cp conf/artalk.example.yml artalk.yml
vim artalk.yml

# 运行程序
Expand Down
6 changes: 3 additions & 3 deletions docs/guide/backend/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ artalk -c ./conf.yml

## 获取模版配置文件

可参考一份「完整的配置文件」:[artalk.example.yml](https://github.com/ArtalkJS/Artalk/blob/master/artalk.example.yml)
可参考一份「完整的配置文件」:[artalk.example.yml](https://github.com/ArtalkJS/Artalk/blob/master/conf/artalk.example.yml)

#### 使用 gen 命令生成配置文件

Expand All @@ -25,11 +25,11 @@ artalk gen conf ./artalk.yml
#### 命令行下载配置文件

```bash
curl -L https://raw.githubusercontent.com/ArtalkJS/Artalk/master/artalk.example.yml > artalk.yml
curl -L https://raw.githubusercontent.com/ArtalkJS/Artalk/master/conf/artalk.example.yml > artalk.yml
```

```bash
wget -O artalk.yml https://raw.githubusercontent.com/ArtalkJS/Artalk/master/artalk.example.yml
wget -O artalk.yml https://raw.githubusercontent.com/ArtalkJS/Artalk/master/conf/artalk.example.yml
```

## 加密密钥 `app_key`
Expand Down
Loading